This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |