이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#include "coprobber.h"
using namespace std;
#define pb push_back
#define ll long long
#define F first
#define S second
#define all(s) s.begin(),s.end()
const int maxn = 502 ;
bool mark[maxn][maxn][2] , ans[maxn][maxn][2] , c[500][500] ;
int nxt[maxn][maxn] , cur = 0;
vector <int> G[maxn] ;
bool dfs(int vi , int vj , int k){
if(mark[vi][vj][k] == 1)return ans[vi][vj][k] ;
mark[vi][vj][k] =1 ;
if(vi==vj){
ans[vi][vj][k] = 1;
return 1;
}
if(k == 0){
if(dfs(vi , vj, 1) == 1){
ans[vi][vj][0] = 1;
nxt[vi][vj] = vi ;
}
for(int i = 0 ; i < G[vi].size() ; i++){
int u = G[vi][i] ;
if(dfs(u,vj,1) == 1){
nxt[vi][vj] = u ;
ans[vi][vj][0] = 1 ;
}
}
}else{
ans[vi][vj][1] = 1 ;
for(int i= 0 ; i < G[vj].size() ; i++){
int u = G[vj][i] ;
if(dfs(vi , u, 0) == 0){
ans[vi][vj][1] =0 ;
}
}
}
return ans[vi][vj][k] ;
}
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] == 1){
G[i].pb(j) ;
}
}
}
for(int i = 0 ; i < n ; i++){
for(int j = 0 ; j < n ; j++){
for(int k = 0 ; k <2;k ++){
dfs(i , j , k) ;
}
}
}
cur = -1 ;
for(int i = 0 ; i < n ; i++){
bool ok =1 ;
for(int j =0 ; j < n ; j++){
if(ans[i][j][0] == 0)ok =0 ;
}
if(ok == 1){
cur = i ;
break ;
}
}
return cur ;
}
int nextMove(int r){
cur = nxt[cur][r] ;
return cur ;
}
컴파일 시 표준 에러 (stderr) 메시지
coprobber.cpp: In function 'bool dfs(int, int, int)':
coprobber.cpp:28:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for(int i = 0 ; i < G[vi].size() ; i++){
| ~~^~~~~~~~~~~~~~
coprobber.cpp:37:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
37 | for(int i= 0 ; i < G[vj].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... |