이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "coprobber.h"
#include<bits/stdc++.h>
using namespace std;
vector<vector<bool> > wing(500,vector<bool> (500));
vector<vector<bool> > winb(500,vector<bool> (500));
vector<vector<int> > cntl(500,vector<int> (500));
vector<vector<int> > go(500,vector<int> (500));
vector<vector<bool> > a(500,vector<bool> (500));
vector<vector<int> > edge(500);
int n,cr=0;
int start(int _N,bool A[500][500]){
n=_N;
queue<vector<int> > q;
for(int i = 0 ; i < n ; i ++){
for(int j = 0 ; j < n ; j ++){
a[i][j]=A[i][j];
if(a[i][j]){
edge[i].push_back(j);
wing[i][j]=true;
q.push({0,i,j});
go[i][j]=j;
}
}
}
for(int i = 0 ; i < n ; i ++){
for(int j = 0 ; j < n ; j ++){
if(i==j)continue;
cntl[i][j]=edge[j].size();
if(a[j][i])cntl[i][j]--;
}
}
while(q.size()){
vector<int> nw=q.front();
q.pop();
int x=nw[2];
int y=nw[1];
int st=nw[0];
if(st==0){
for(int i = 0 ; i < edge[x].size() ; i ++){
int ne=edge[x][i];
if(ne==y)continue;
cntl[y][ne]--;
if(cntl[y][ne])continue;
q.push({1,y,ne});
winb[y][ne]=true;
}
}else{
for(int i = 0 ; i < edge[y].size() ; i ++){
int ne=edge[y][i];
if(ne==x)continue;
if(wing[ne][x])continue;
go[ne][x]=y;
wing[ne][x]=true;
q.push({0,ne,x});
}
}
}
cr=0;
return 0;
}
int nextMove(int np){
cr=go[cr][np];
return cr;
}/*
int main(){
int N;
cin>>N;
vector<vector<int> > A(N,vector<int> (N));
for(int i = 0 ; i < N ;i ++){
for(int j = 0 ; j < N ; j ++){
cin>>A[i][j];
}
}
int CP=start(N,A),one;
cin>>one;
vector<vector<int> > dir(n,vector<int> (n+1));
for(int i = 0 ; i < N ; i ++)
for(int j = 0 ; j <= N ; j ++)
cin>>dir[i][j];
int BP=dir[CP].back();
while(CP!=BP){
cout<<CP<<" "<<BP<<" ";
BP=dir[CP][BP];
CP=nextMove(BP);
}
cout<<CP<<" "<<BP;
}*/
컴파일 시 표준 에러 (stderr) 메시지
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:39:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0 ; i < edge[x].size() ; i ++){
~~^~~~~~~~~~~~~~~~
coprobber.cpp:48:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0 ; i < edge[y].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... |