#include<bits/stdc++.h>
#include "monster.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,f[1009],ZX,XC;
bool bo[1009][1009],BO[1009][1009];
vector <int> ANS;
void query(int q, int w){
if(BO[q][w]==1) return;
BO[q][w]=1;bo[q][w]=Query(q,w);
}
vector<int> Solve(int N) {
a=N;ANS.resize(a);
for(i=0; i<a; i++){
for(j=i+1; j<a; j++){
if(i==j) continue;
query(i,j);
if(bo[i][j]==1){
f[i]++;
}else{
f[j]++;
}
}
}
for(i=0; i<a; i++){
if(1<f[i]&&f[i]<a-2){
ANS[i]=f[i];
continue;
}
if(f[i]==1){
if(zx==0){
zx=i;
}else{
xc=i;
}
}else{
if(ZX==0){
ZX=i;
}else{
XC=i;
}
}
}
if(bo[zx][xc]==1){
ANS[zx]=0;ANS[xc]=1;
}else{
ANS[zx]=1;ANS[xc]=0;
}
if(bo[ZX][XC]==1){
ANS[ZX]=a-2;ANS[XC]=a-1;
}else{
ANS[ZX]=a-1;ANS[XC]=a-2;
}
return ANS;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Output is correct |
2 |
Incorrect |
0 ms |
200 KB |
Wrong Answer [3] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
247 ms |
456 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |