이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define x first
#define y second
#define pii pair<int, int>
#define p3i pair<pii, int>
#define pll pair<ll, ll>
#define p3l pair<pll, ll>
#define lseg L, (L+R)/2, N*2+1
#define rseg (L+R)/2+1, R, N*2+2
#define ub upper_bound
#define lb lower_bound
#define pq priority_queue
#define MN 1000000007
#define fox(k, x) for (int k=0; k<x; ++k)
#define fox1(k, x) for (int k=1; k<=x; ++k)
#define foxr(k, x) for (int k=x-1; k>=0; --k)
#define fox1r(k, x) for (int k=x; k>0; --k)
#define ms multiset
#define flood(x) memset(x, 0x3f3f3f3f, sizeof x)
#define drain(x) memset(x, 0, sizeof x)
#define rng() (rand() >> 3)*rand()
int n, m, a, b, p, nxt[505][505], in[505][505];
bool u[505][505][2], t;
vector<int> v[505];
queue<pair<pii, pii> > q;
#define top front
int start (int N, bool A[][500]){
fox(l, N){
fox(l2, N){
if (A[l][l2]) {
v[l].pb(l2);
fox(l3, N){
in[l3][l2]++;
}
}
}
}
fox(l, N){
q.push(mp(mp(l, l), mp(0, -1)));
q.push(mp(mp(l, l), mp(1, -1)));
}
while(!q.empty()){
a=q.top().x.x; b=q.top().x.y; t=q.top().y.x; p=q.top().y.y; q.pop();
if (u[a][b][t]) continue;
if (t) nxt[a][b]=p;
u[a][b][t]=1;
//cout << a << ' ' << b << ' ' << t<< endl;
if (t){
fox(l, v[b].size()){
in[a][v[b][l]]--;
if (in[a][v[b][l]]==0){
if (!u[a][v[b][l]][!t])
q.push(mp(mp(a, v[b][l]), mp(!t, b)));
}
}
} else {
fox(l, v[a].size()){
if (!u[v[a][l]][b][!t])
q.push(mp(mp(v[a][l], b), mp(!t, a)));
}
if (!u[a][b][!t])
q.push(mp(mp(a, b), mp(!t, a)));
}
}
fox(l, N){
bool f=1;
fox(l2, N){
if (u[l][l2][1]==0){
f=0;
break;
}
}
if (f){
return l;
}
}
return -1;
}
int nextMove(int R){
m=R;
if (n==m) return n;
n=nxt[n][m];
return n;
}
/*int main(){
int n;
bool a[500][500];
cin >> n;
fox(l, n) fox(l2, n) cin >> a[l][l2];
//fox(l, n) fox(l2, n) cout << dp[l][l2][0];
cout << start(n, a);
}*/
컴파일 시 표준 에러 (stderr) 메시지
coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define fox(k, x) for (int k=0; k<x; ++k)
coprobber.cpp:54:17:
fox(l, v[b].size()){
~~~~~~~~~~~~~~
coprobber.cpp:54:13: note: in expansion of macro 'fox'
fox(l, v[b].size()){
^~~
coprobber.cpp:18:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define fox(k, x) for (int k=0; k<x; ++k)
coprobber.cpp:62:17:
fox(l, v[a].size()){
~~~~~~~~~~~~~~
coprobber.cpp:62:13: note: in expansion of macro 'fox'
fox(l, v[a].size()){
^~~
# | 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... |