Advertisement
Brick99

CCC08 Nukit

May 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <cmath>
  4. #include <algorithm>
  5. #include <vector>
  6. #include <iomanip>
  7. #include <stack>
  8. #include <queue>
  9. #include <set>
  10. #include <utility>
  11.  
  12. using namespace std;
  13.  
  14. int m[5][4] = { {2,1,0,2}, {1,1,1,1}, {0,0,2,1}, {0,3,0,0}, {1,0,0,1} };
  15. bool dp[31][31][31][31] = {false};
  16.  
  17. bool flag(int a, int b, int c, int d)
  18. {
  19.     if ( a < 0 || b < 0 || c < 0 || d < 0 ) return false;
  20.     if ( dp[a][b][c][d] == true ) return false;
  21.     return true;
  22. }
  23.  
  24. int main()
  25. {
  26.     int n;
  27.     cin>>n;
  28.  
  29.     for (int a=0;a<31;a++)
  30.         for (int b=0;b<31;b++)
  31.             for (int c=0;c<31;c++)
  32.                 for (int d=0;d<31;d++)
  33.                     for (int i=0;i<5;i++)
  34.                         if ( flag(a-m[i][0],b-m[i][1],c-m[i][2],d-m[i][3]) )dp[a][b][c][d] = true;
  35.  
  36.     while (n--)
  37.     {
  38.         int a,b,c,d;
  39.         cin>>a>>b>>c>>d;
  40.  
  41.         if ( dp[a][b][c][d] ) cout<<"Patrick"<<endl;
  42.         else cout<<"Roland"<<endl;
  43.     }
  44.     return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement