Advertisement
alxczr

CodeChef IGAME solution not working

May 11th, 2023
1,270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4. const int N = 1005;
  5. int main(){
  6.     ios_base::sync_with_stdio(false); cin.tie(nullptr);
  7.     vector<vector<int>> dp(N,vector<int>(N,1));
  8.     dp[0][0] = 0;
  9.     int dr[] = {2,3}, dc[] = {1,2};
  10.     int i=0, j=0, r=0;
  11.     while(i<N && j<N) {
  12.         dp[i][j] = 0;
  13.         dp[j][i] = 0;
  14.         i += dr[r];
  15.         j += dc[r];
  16.         r ^= 1;
  17.     }
  18.     int tt; cin >> tt;
  19.     while (tt--) {
  20.         int m, n, p, q;
  21.         cin >> m >> n >> p >> q;
  22.         cout << (dp[m-p][n-q] ? "Alice" : "Bob") << '\n';
  23.     }
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement