#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]++;
}
}
}
zx=xc=-1;
ZX=XC=-1;
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==-1){
zx=i;
}else{
xc=i;
}
}else{
if(ZX==-1){
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 |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
0 ms |
200 KB |
Output is correct |
8 |
Correct |
0 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
1 ms |
200 KB |
Output is correct |
13 |
Correct |
1 ms |
200 KB |
Output is correct |
14 |
Correct |
1 ms |
200 KB |
Output is correct |
15 |
Correct |
1 ms |
200 KB |
Output is correct |
16 |
Correct |
146 ms |
796 KB |
Output is correct |
17 |
Correct |
154 ms |
560 KB |
Output is correct |
18 |
Correct |
71 ms |
584 KB |
Output is correct |
19 |
Correct |
146 ms |
576 KB |
Output is correct |
20 |
Correct |
133 ms |
564 KB |
Output is correct |
21 |
Correct |
1 ms |
200 KB |
Output is correct |
22 |
Correct |
1 ms |
200 KB |
Output is correct |
23 |
Correct |
0 ms |
200 KB |
Output is correct |
24 |
Correct |
1 ms |
200 KB |
Output is correct |
25 |
Correct |
1 ms |
200 KB |
Output is correct |
26 |
Correct |
160 ms |
848 KB |
Output is correct |
27 |
Correct |
1 ms |
200 KB |
Output is correct |
28 |
Correct |
1 ms |
200 KB |
Output is correct |
29 |
Correct |
0 ms |
200 KB |
Output is correct |
30 |
Correct |
1 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
186 ms |
636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
200 KB |
Output is correct |
2 |
Correct |
1 ms |
200 KB |
Output is correct |
3 |
Correct |
1 ms |
200 KB |
Output is correct |
4 |
Correct |
0 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
0 ms |
200 KB |
Output is correct |
8 |
Correct |
0 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Correct |
1 ms |
200 KB |
Output is correct |
12 |
Correct |
1 ms |
200 KB |
Output is correct |
13 |
Correct |
1 ms |
200 KB |
Output is correct |
14 |
Correct |
1 ms |
200 KB |
Output is correct |
15 |
Correct |
1 ms |
200 KB |
Output is correct |
16 |
Correct |
146 ms |
796 KB |
Output is correct |
17 |
Correct |
154 ms |
560 KB |
Output is correct |
18 |
Correct |
71 ms |
584 KB |
Output is correct |
19 |
Correct |
146 ms |
576 KB |
Output is correct |
20 |
Correct |
133 ms |
564 KB |
Output is correct |
21 |
Correct |
1 ms |
200 KB |
Output is correct |
22 |
Correct |
1 ms |
200 KB |
Output is correct |
23 |
Correct |
0 ms |
200 KB |
Output is correct |
24 |
Correct |
1 ms |
200 KB |
Output is correct |
25 |
Correct |
1 ms |
200 KB |
Output is correct |
26 |
Correct |
160 ms |
848 KB |
Output is correct |
27 |
Correct |
1 ms |
200 KB |
Output is correct |
28 |
Correct |
1 ms |
200 KB |
Output is correct |
29 |
Correct |
0 ms |
200 KB |
Output is correct |
30 |
Correct |
1 ms |
200 KB |
Output is correct |
31 |
Correct |
1 ms |
200 KB |
Output is correct |
32 |
Correct |
186 ms |
636 KB |
Output is correct |
33 |
Incorrect |
236 ms |
312 KB |
Wrong Answer [6] |
34 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
219 ms |
440 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |