Submission #41692

#TimeUsernameProblemLanguageResultExecution timeMemory
41692gabrielsimoesCop and Robber (BOI14_coprobber)C++14
14 / 100
43 ms1784 KiB
#include "coprobber.h" #include <bits/stdc++.h> using namespace std; vector<int> g[MAX_N]; int pos = 0, width = 1; int start(int N, bool A[MAX_N][MAX_N]) { for (int i = 0; i < N; i++) { for (int k = 0; k < N; k++) { if (A[i][k]) { g[i].push_back(k); } } } while (g[width].size() == 3) width++; width++; return 0; } int nextMove(int R) { int copX = pos % width, copY = pos / width; int robberX = R % width, robberY = R / width; int distX = abs(copX - robberX), distY = abs(copY - robberY); if (distX > distY) return pos = pos + (robberX < copX ? -1 : 1); else if (distY > distX) return pos = pos + (robberY < copY ? -1 : 1) * width; else return pos; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...