Submission #677301

#TimeUsernameProblemLanguageResultExecution timeMemory
677301TruitadepatatesCop and Robber (BOI14_coprobber)C++14
0 / 100
1 ms464 KiB
#include <bits/stdc++.h> using namespace std; //subtask 2 vector<int> adj[501]; int cop = 1; int vertex2; int start(int n, bool a[500][500]){ for (int i = 0; i < n; i++){ for (int j = 0; j < n; j++){ if (a[i][j] == 1){ adj[i+1].push_back(j+1); } } } for (int i = 2; i < n; i++){ if (adj[i].size() == 2) { vertex2 = i; break; } } return 0; } int nextMove(int r){ r++; if (r == cop) return r-1; if ((r == cop+1 && cop%vertex2 != 0) or (r = cop-1 && cop%vertex2 != 1) or (r == cop+vertex2) or (r == cop-vertex2)){ cop = r; return r-1; } if ((r == cop+vertex2+1 && cop%vertex2 != 0) or (r == cop+vertex2-1 && cop%vertex2 != 1) or (r == cop-vertex2-1 && cop%vertex2 != 1) or (r == cop-vertex2+1 && cop%vertex2 != 0)){ return cop-1; } if (r > cop){ if (r <= cop+(vertex2-(cop%vertex2))){ cop++; return cop-1; } if (r < cop+vertex2){ cop--; return cop-1; } if (r <= cop+vertex2+(vertex2-(cop%vertex2))){ cop++; return cop-1; } cop+=vertex2; return cop-1; } else{ if (r > cop-(cop%vertex2)){ cop--; return cop-1; } if (r > cop-vertex2){ cop++; return cop-1; } if (r > cop-vertex2-(cop%vertex2)){ cop--; return cop-1; } cop-=vertex2; return cop-1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...