Submission #1075969

#TimeUsernameProblemLanguageResultExecution timeMemory
1075969raphaelpCop and Robber (BOI14_coprobber)C++14
0 / 100
1 ms344 KiB
#include <bits/stdc++.h> #include "coprobber.h" using namespace std; vector<vector<int>> AR; int pos = 0; 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]) { AR[i].push_back(j); AR[j].push_back(i); } } } for (int i = 0; i < N; i++) { vector<int> occ(N); queue<int> Q; occ[i] = 2; for (int j = 0; j < AR[i].size(); j++) { int x = AR[i][j]; occ[x] = x; for (int k = 0; k < AR[x].size(); k++) { if (occ[AR[x][k]]) occ[AR[x][k]] = -1; else occ[AR[x][k]] = x; } } for (int j = 0; j < N; j++) if (occ[j] != j && occ[j] != 0 && occ[j] != -1) Q.push(j); while (!Q.empty()) { int x = Q.front(); Q.pop(); for (int j = 0; j < AR[x].size(); j++) { if (occ[AR[x][j]] != 0 && occ[AR[x][j]] != occ[x]) return -1; occ[AR[x][j]] = occ[x]; Q.push(AR[x][j]); } } } return 1; } int nextMove(int R) { return -1; }

Compilation message (stderr)

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:25:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for (int j = 0; j < AR[i].size(); j++)
      |                         ~~^~~~~~~~~~~~~~
coprobber.cpp:29:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             for (int k = 0; k < AR[x].size(); k++)
      |                             ~~^~~~~~~~~~~~~~
coprobber.cpp:44:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |             for (int j = 0; j < AR[x].size(); j++)
      |                             ~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...