# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1053365 | SzymonKrzywda | Cop and Robber (BOI14_coprobber) | C++17 | 38 ms | 2904 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
vector<int> graf[500];
int odl[500][500];
int akt_pos = 0;
int start(int n,bool A[][500] ){
for (int i=0; i<n; i++){
for (int j=0; j<n; j++){
if (A[i][j]) graf[i].push_back(j);
}
}
for (int i=0; i<n; i++){
vector<bool> odwiedzone(n,false);
queue<pair<int,int>> kolejka;
odwiedzone[i] = true;
kolejka.push({0,i});
while (!kolejka.empty()){
int v = kolejka.front().second;
int val = kolejka.front().first;
kolejka.pop();
odl[i][v] = val;
for (int s : graf[v]){
if (!odwiedzone[s]){
odwiedzone[s] = true;
kolejka.push({val+1,s});
}
}
}
}
return 0;
}
int nextMove(int R){
int akt_k,akt_m=1e8;
for (int s : graf[akt_pos]){
int maxi=0;
for (int s_2 : graf[R]){
maxi = max(maxi,odl[s][s_2]);
}
if (maxi < akt_m){
akt_k = s;
akt_m = maxi;
}
}
akt_pos = akt_k;
return akt_k;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |