# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
733514 | Trunkty | Cop and Robber (BOI14_coprobber) | C++14 | 1 ms | 208 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;
typedef long long ll;
//#define int ll
#include "coprobber.h"
bool isgood[505][505][2]; // 0 - robber, 1 - cop
int cnt[505][505];
vector<tuple<int,int,int>> v;
int start(int n, bool arr[MAX_N][MAX_N]){
for(int i=0;i<n;i++){
isgood[i][i][0] = true;
isgood[i][i][1] = true;
v.push_back(make_tuple(i,i,0));
v.push_back(make_tuple(i,i,1));
for(int j=0;j<n;j++){
if(arr[i][j]){
cnt[i][0]++;
}
}
for(int j=1;j<n;j++){
cnt[i][j] = cnt[i][j-1];
}
}
for(int i=0;i<v.size();i++){
int a = get<0>(v[i]), b = get<1>(v[i]), c = get<2>(v[i]);
if(c==0){
for(int j=0;j<n;j++){
if(arr[b][j]){
if(!isgood[a][j][1]){
isgood[a][j][1] = true;
v.push_back(make_tuple(a,j,1));
}
}
}
}
else{
for(int j=0;j<n;j++){
if(arr[a][j]){
if(!isgood[j][b][0]){
cnt[j][b]--;
if(cnt[j][b]==0){
isgood[j][b][0] = true;
v.push_back(make_tuple(j,b,0));
}
}
}
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(!isgood[i][j][0] or !isgood[i][j][1]){
return -1;
}
}
}
return 1;
}
int nextMove(int r){
return -1;
}
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... |