이 제출은 이전 버전의 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],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});
while(deq.size()){
st v=deq.front();
deq.pop_front();
dp[v.a][v.b][v.c]=1;
if(v.c){
for(auto u:graf[v.b]){
il[u]++;
if(il[u]==graf[u].size()) deq.push_back({u,v.a,0});
}
}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;
if(!dp[v.b][v.a][1]) deq.push_back({v.b,v.a,1}),nxt[v.b][v.a]=v.b;
}
}
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){
return nxt[last][R];
}
컴파일 시 표준 에러 (stderr) 메시지
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:42:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
42 | if(il[u]==graf[u].size()) deq.push_back({u,v.a,0});
| ~~~~~^~~~~~~~~~~~~~~~
# | 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... |