fork(3) download
  1. #include <algorithm>
  2. #include <functional>
  3. #include <iostream>
  4. #include <list>
  5. #include <map>
  6. #include <math.h>
  7. #include <set>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <string>
  11. #include <string.h>
  12. #include <time.h>
  13. #include <queue>
  14. #include <utility>
  15. #include <vector>
  16. using namespace std;
  17.  
  18. #define y0 y123
  19. #define y1 y1234
  20. #define ll long long
  21. const double PI = acos(-1.0);
  22. const double EPS = 1e-9;
  23. const int INF = 2e9;
  24. const int N = (int) (1e6);
  25.  
  26. int nextInt() { int n; scanf("%d", &n); return n; }
  27.  
  28. bool used[N + 1];
  29. set<pair<int, int> > losing;
  30.  
  31. int main() {
  32. int d = 0;
  33. for (int i = 0; i + d <= N; ++i) {
  34. if (!used[i] && !used[i + d]) {
  35. // cout<<(i)<<" "<<(i+d)<<endl;
  36. losing.insert({i, i + d});
  37. used[i + d] = true;
  38. ++d;
  39. }
  40. }
  41.  
  42. int t = nextInt();
  43.  
  44. for (int tt = 0; tt < t; ++tt) {
  45. int n1 = nextInt();
  46. int n2 = nextInt();
  47.  
  48.  
  49. if (losing.find({n1, n2}) != losing.end() ||
  50. losing.find({n2, n1}) != losing.end()) {
  51. puts("Don't Play");
  52. } else {
  53. puts("Play");
  54. }
  55. }
  56. return 0;
  57. }
  58.  
  59.  
Success #stdin #stdout 0.17s 16088KB
stdin
5
1 2
2 4
4 7 
6 10
8 13
stdout
Don't Play
Play
Don't Play
Don't Play
Don't Play