Submission #41690

#TimeUsernameProblemLanguageResultExecution timeMemory
41690gabrielsimoesCop and Robber (BOI14_coprobber)C++14
Compilation error
0 ms0 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 cop = cop + (robberX < copX ? -1 : 1); else if (distY > distX) return cop = cop + (robberY < copY ? -1 : 1) * width; else return cop; }

Compilation message (stderr)

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:29:12: error: 'cop' was not declared in this scope
     return cop = cop + (robberX < copX ? -1 : 1);
            ^~~
coprobber.cpp:29:12: note: suggested alternative: 'copY'
     return cop = cop + (robberX < copX ? -1 : 1);
            ^~~
            copY
coprobber.cpp:31:12: error: 'cop' was not declared in this scope
     return cop = cop + (robberY < copY ? -1 : 1) * width;
            ^~~
coprobber.cpp:31:12: note: suggested alternative: 'copY'
     return cop = cop + (robberY < copY ? -1 : 1) * width;
            ^~~
            copY
coprobber.cpp:33:12: error: 'cop' was not declared in this scope
     return cop;
            ^~~
coprobber.cpp:33:12: note: suggested alternative: 'copY'
     return cop;
            ^~~
            copY