이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "coprobber.h"
#include<bits/stdc++.h>
#define fi first
#define se second
#define pitem item*
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
const int N=500;
const int SS=1<<19;
const int INFi=2e9;
const ll INFl=1e13;
const ll mod2=998244353;
const ll mod=1e9+7;
const ll mod3=1000696969;
const ll p=70032301;
const ull p2=913;
const int L=20;
struct st{
int a,b,c;
};
bool dp[N][N][2];
int nxt[N][N],il[N][N],last;
vi graf[N];
int start(int n, bool t[N][N]){
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
if(t[i][j]) graf[i].push_back(j);
}
deque<st>deq;
for(int i=0;i<n;i++){
deq.push_back({i,i,0}),deq.push_back({i,i,1});
dp[i][i][0]=1,dp[i][i][1]=1;
}
while(deq.size()){
st v=deq.front();
deq.pop_front();
if(v.c){
for(auto u:graf[v.b]){
il[u][v.a]++;
if(il[u][v.a]==graf[u].size()) deq.push_back({u,v.a,0}),dp[u][v.a][0]=1;
}
}else{
for(auto u:graf[v.b])
if(!dp[u][v.a][1]) deq.push_back({u,v.a,1}),nxt[u][v.a]=v.b,dp[u][v.a][1]=1;
if(!dp[v.b][v.a][1]) deq.push_back({v.b,v.a,1}),nxt[v.b][v.a]=v.b,dp[v.b][v.a][1]=1;
}
}
for(int i=0;i<n;i++){
bool ok=1;
for(int k=0;k<n;k++) ok&=dp[i][k][1];
if(ok){
last=i;
return i;
}
}
return -1;
}
int nextMove(int R){
int res=nxt[last][R];
last=res;
return res;
}
컴파일 시 표준 에러 (stderr) 메시지
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:43:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | if(il[u][v.a]==graf[u].size()) deq.push_back({u,v.a,0}),dp[u][v.a][0]=1;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~
# | 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... |