이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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],pre[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]){
pre[a][j] = b;
isgood[a][j][1] = true;
v.push_back(make_tuple(a,j,1));
}
}
}
if(!isgood[a][b][1]){
pre[a][b] = b;
isgood[a][b][1] = true;
v.push_back(make_tuple(a,b,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 curr=1;
int nextMove(int r){
int a = pre[r][curr];
curr = a;
return a;
}
컴파일 시 표준 에러 (stderr) 메시지
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<int, int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for(int i=0;i<v.size();i++){
| ~^~~~~~~~~
# | 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... |