QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#117100 | #6668. Trokuti | youngsystem# | 0 | 22ms | 6012kb | C++20 | 4.4kb | 2023-06-30 12:53:48 | 2024-05-31 18:42:06 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
inline int read()
{
int n=0,f=1,ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
{
n=n*10+ch-'0';
ch=getchar();
}
return n*f;
}
int ans[105][105][105];
int sc[105][105];
int yl[105][105];
int p[1005];
mt19937 ran(1145119);
int xl1[1005],cnt1;
int xl2[1005],cnt2;
int wz[1005],tmp;
int fa[2005],nqd[2005];
int findf(int n)
{
if(fa[n]==n)return n;
return fa[n]=findf(fa[n]);
}
void merge(int x,int y)
{
x=findf(x);
y=findf(y);
fa[x]=y;
}
int qsl;
int ask(int i,int j,int k)
{
qsl++;
assert(qsl<=100000);
printf("? %d %d %d\n",i,j,k);
fflush(stdout);
int ans=read();
return ans;
}
int main()
{
/*for(int i=1;i<=100;i++)
{
for(int j=i+1;j<=100;j++)
{
yl[i][j]=ran()%2;
yl[j][i]=yl[i][j];
}
}*/
int n=7;
for(int i=1;i<=100;i++)p[i]=i;
for(int i=1;i<=100;i++)swap(p[ran()%i+1],p[i]);
for(int i=2;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
ans[p[1]][p[i]][p[j]]=ask(p[1],p[i],p[j]);
ans[p[1]][p[j]][p[i]]=ans[p[1]][p[i]][p[j]];
}
}
for(int i=2;i<=n;i++)
{
cnt1=cnt2=0;
bool qd=false;
for(int j=2;j<=n;j++)
{
if(j==i)continue;
if(ans[p[1]][p[i]][p[j]]==0)
{
qd=true;
sc[p[1]][p[i]]=0;
break;
}
if(ans[p[1]][p[i]][p[j]]==3)
{
qd=true;
sc[p[1]][p[i]]=1;
break;
}
if(ans[p[1]][p[i]][p[j]]==1)xl1[++cnt1]=j;
else xl2[++cnt2]=j;
}
if(qd)continue;
if(cnt1>=3)
{
int sth=ask(p[xl1[1]],p[xl1[2]],p[xl1[3]]);
if(sth!=0)
{
sc[p[1]][p[i]]=0;
continue;
}
if(ans[p[1]][p[xl1[1]]][p[xl1[2]]]>=2)sc[p[1]][p[i]]=0;
else sc[p[1]][p[i]]=1;
}
else
{
int sth=ask(p[xl2[1]],p[xl2[2]],p[xl2[3]]);
if(sth!=3)
{
sc[p[1]][p[i]]=1;
continue;
}
if(ans[p[1]][p[xl2[1]]][p[xl2[2]]]>=2)sc[p[1]][p[i]]=0;
else sc[p[1]][p[i]]=1;
}
}
for(int i=2;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
sc[p[i]][p[j]]=ans[p[1]][p[i]][p[j]]-sc[p[1]][p[i]]-sc[p[1]][p[j]];
}
}
for(int i=1;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
sc[p[j]][p[i]]=sc[p[i]][p[j]];
}
}
n=100;
for(int i=8;i<=n;i++)
{
for(int j=1;j<=2*(i-1);j++)
{
fa[j]=j;
nqd[j]=-1;
}
int x,y;
while(1)
{
tmp=0;
for(int j=1;j<=(i-1);j++)
{
if(findf(j)==j&&nqd[j]==-1)wz[++tmp]=j;
}
//printf("!!!%d\n",tmp);
if(tmp==0)break;
if(tmp>=2)
{
int x=ran()%tmp+1,y=ran()%tmp+1;
while(x==y)
{
x=ran()%tmp+1;
y=ran()%tmp+1;
}
//printf("orz%d %d %d\n",x,y,tmp);
int sth=ask(p[i],p[wz[x]],p[wz[y]])-sc[p[wz[x]]][p[wz[y]]];
//printf("%d %d %d\n",wz[x],wz[y],sth);
if(sth==0)
{
merge(wz[x],wz[y]);
merge(wz[x]+i-1,wz[y]+i-1);
nqd[findf(wz[x])]=0;
nqd[findf(wz[x]+i-1)]=1;
}
else if(sth==2)
{
merge(wz[x],wz[y]);
merge(wz[x]+i-1,wz[y]+i-1);
nqd[findf(wz[x])]=1;
nqd[findf(wz[x]+i-1)]=0;
}
else
{
merge(wz[x],wz[y]+i-1);
merge(wz[x]+i-1,wz[y]);
}
}
else
{
tmp=0;
for(int j=1;j<=i-1;j++)
{
if(findf(j)<=i-1&&nqd[findf(j)]==-1)wz[++tmp]=j;
}
if(tmp==0)
{
tmp=0;
for(int j=1;j<=i-1;j++)
{
if(findf(j)>i-1&&nqd[findf(j)]==-1)wz[++tmp]=j;
}
}
int gre=0;
for(int j=1;j<=i-1;j++)
{
if(nqd[findf(j)]!=-1)gre=j;
}
if(gre!=0)
{
int sth=ask(p[i],p[wz[1]],p[gre])-sc[p[wz[1]]][p[gre]]-nqd[findf(gre)];
if(sth==0)
{
nqd[findf(wz[1])]=0;
nqd[findf(wz[1]+i-1)]=1;
}
else
{
nqd[findf(wz[1])]=1;
nqd[findf(wz[1]+i-1)]=0;
}
break;
}
if(tmp<=1)
{
tmp=0;
for(int j=1;j<=i-1;j++)
{
if(findf(j)>i-1&&nqd[findf(j)]==-1)wz[++tmp]=j;
}
}
int sth=ask(p[i],p[wz[1]],p[wz[2]])-sc[p[wz[1]]][p[wz[2]]];
if(sth==2)
{
nqd[findf(wz[1])]=1;
nqd[findf(wz[1]+i-1)]=0;
}
else
{
nqd[findf(wz[1])]=0;
nqd[findf(wz[1]+i-1)]=1;
}
break;
}
}
for(int j=1;j<=i-1;j++)
{
if(nqd[findf(j)]==1)sc[p[i]][p[j]]=sc[p[j]][p[i]]=1;
else sc[p[i]][p[j]]=sc[p[j]][p[i]]=0;
}
}
printf("!\n");
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
printf("%d",sc[i][j]);
}
printf("\n");
}
fflush(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 100
Accepted
time: 0ms
memory: 6004kb
input:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 36 98 87 ? 36 10 34 ? 36 40 4 ? 36 64 10 ? 74 4 10 ? 74 40 87 ? 74 34 36 ? 74 98 64 ? 18 40 98 ? 18 64 4 ? 18 74 34 ? 18 87 10 ? 18 36 74 ...
result:
points 1.0 points 1.0 correct 2503 queries
Test #2:
score: 100
Accepted
time: 7ms
memory: 5956kb
input:
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 36 98 87 ? 36 10 34 ? 36 40 4 ? 36 64 10 ? 74 4 10 ? 74 40 87 ? 74 34 36 ? 74 98 64 ? 18 40 98 ? 18 64 4 ? 18 74 34 ? 18 87 10 ? 18 36 74 ...
result:
points 1.0 points 1.0 correct 2503 queries
Test #3:
score: 100
Accepted
time: 16ms
memory: 3924kb
input:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 36 98 87 ? 36 10 34 ? 36 40 4 ? 36 64 10 ? 74 4 10 ? 74 40 87 ? 74 34 36 ? 74 98 64 ? 18 40 98 ? 18 64 4 ? 18 74 34 ? 18 87 10 ? 18 36 74 ...
result:
points 1.0 points 1.0 correct 2504 queries
Test #4:
score: 100
Accepted
time: 0ms
memory: 5892kb
input:
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 36 98 87 ? 36 10 34 ? 36 40 4 ? 36 64 10 ? 74 4 10 ? 74 40 87 ? 74 34 36 ? 74 98 64 ? 18 40 98 ? 18 64 4 ? 18 74 34 ? 18 87 10 ? 18 36 74 ...
result:
points 1.0 points 1.0 correct 2504 queries
Test #5:
score: 100
Accepted
time: 4ms
memory: 5952kb
input:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 36 98 87 ? 36 10 34 ? 36 40 4 ? 36 64 10 ? 74 4 10 ? 74 40 87 ? 74 34 36 ? 74 98 64 ? 18 40 98 ? 18 64 4 ? 18 74 34 ? 18 87 10 ? 18 36 74 ...
result:
points 1.0 points 1.0 correct 2513 queries
Test #6:
score: 100
Accepted
time: 2ms
memory: 3860kb
input:
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 36 98 87 ? 36 10 34 ? 36 40 4 ? 36 64 10 ? 74 4 10 ? 74 40 87 ? 74 34 36 ? 74 98 64 ? 18 40 98 ? 18 64 4 ? 18 74 34 ? 18 87 10 ? 18 36 74 ...
result:
points 1.0 points 1.0 correct 2509 queries
Test #7:
score: 100
Accepted
time: 7ms
memory: 6012kb
input:
0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 2 1 0 0 1 1 0 0 2 0 0 0 1 1 0 1 2 0 1 0 3 0 1 2 0 0 1 1 2 2 1 0 0 0 0 1 0 1 2 0 0 2 1 1 0 0 2 0 1 1 0 0 2 0 1 0 0 3 0 0 1 0 1 0 2 1 0 3 0 1 2 0 1 1 0 1 1 1 3 1 1 1 1 1 0 0 1 1 1 1 0 0 1 1 2 0 1 1 0 1 0 2 1 2 0 0 1 1 1 2 3 2 0 1 0 1 1 3 2 0 1 1 2 3 1 1 0 1 1 2 1 2 1 2 0 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 36 98 87 ? 36 64 87 ? 36 40 4 ? 36 10 34 ? 36 87 10 ? 74 4 87 ? 74 36 10 ? 74 64 87 ? 74 98 40 ? 74 34 36 ? 18 64 10 ? 18 4 87 ? 18 98 34 ...
result:
points 1.0 points 1.0 correct 3121 queries
Test #8:
score: 100
Accepted
time: 0ms
memory: 5900kb
input:
1 2 2 2 1 0 0 1 1 0 1 1 0 1 0 1 2 2 1 1 2 3 0 1 1 0 1 0 1 1 0 2 1 2 3 1 1 1 1 0 1 1 0 0 1 1 0 1 1 2 2 1 0 1 1 1 1 1 1 2 2 2 3 1 2 0 1 2 0 1 1 0 2 0 2 1 1 1 1 1 1 2 2 2 1 0 0 0 0 1 1 3 1 2 1 0 1 1 2 2 1 1 1 1 1 1 1 1 1 3 1 0 1 1 0 0 2 3 1 2 2 1 1 1 1 1 0 1 0 0 1 3 0 3 2 0 1 1 1 1 3 2 3 1 2 1 2 2 1 2 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 87 4 10 ? 36 98 87 ? 36 64 87 ? 36 40 4 ? 36 34 87 ? 36 10 4 ? 36 87 10 ? 74 34 10 ? 74 87 40 ? 74 4 64 ? 74 98 36 ? 74 40 36 ? 18 64 36 ?...
result:
points 1.0 points 1.0 correct 3237 queries
Test #9:
score: 100
Accepted
time: 8ms
memory: 6012kb
input:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 1 1 0 0 0 2 1 3 0 2 2 2 3 2 0 0 0 3 1 1 1 3 1 2 1 3 0 1 2 3 3 2 1 0 2 0 1 1 2 0 0 2 2 1 1 2 0 0 2 3 2 0 1 0 0 1 0 0 1 0 3 2 2 2 1 2 1 3 0 0 0 0 0 1 2 2 3 1 3 0 1 2 0 0 0 2 0 0 0 0 3 0 0 0 1 0 0 0 0 3 1 0 0 2 1 1 0 0 0 0 0 0 0 2 0 2 0 2 0 2 0 2 0 2 1 1 3 2 1 3 0 3 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 36 98 87 ? 36 10 34 ? 36 40 4 ? 36 4 64 ? 36 40 10 ? 74 4 10 ? 74 40 98 ? 74 34 87 ? 74 64 36 ? 74 36 10 ? 18 36 74 ? 18 4 10 ? 18 98 34 ?...
result:
points 1.0 points 1.0 correct 3018 queries
Test #10:
score: 100
Accepted
time: 0ms
memory: 3896kb
input:
2 2 2 2 2 2 0 0 2 2 2 2 0 2 2 2 2 2 2 0 0 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 0 0 2 2 2 2 0 2 2 0 2 2 2 2 2 2 2 2 0 2 2 0 2 2 2 2 2 2 0 2 0 0 2 2 0 2 0 0 2 2 2 2 2 2 0 2 2 2 2 2 2 0 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 0 2 2 0 2 0 2 2 2 2 2 0 2 2 2 2 2 0 0 2 2 2 2 2 2 2 0 2 2 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 40 87 4 ? 98 40 4 ? 98 40 87 ? 36 98 87 ? 36 10 34 ? 36 40 4 ? 36 64 10 ? 74 4 10 ? 74 40 87 ? 74 64 34 ? 74 87 36 ? 74 98 36 ? 74 34 36 ?...
result:
points 1.0 points 1.0 correct 3344 queries
Test #11:
score: 0
Wrong Answer
time: 22ms
memory: 5944kb
input:
2 1 2 2 2 2 2 2 2 1 1 1 2 3 3 0 2 2 2 2 3 1 3 1 2 0 1 0 1 3 1 1 0 1 2 0 0 3 1 1 1 1 1 2 2 1 2 1 2 3 1 1 2 2 1 3 1 2 2 1 2 3 2 2 3 1 2 3 0 3 1 2 3 2 1 2 2 1 1 0 2 3 2 2 2 1 3 2 2 1 2 2 2 1 2 3 1 2 0 2 3 2 2 1 2 2 1 1 2 1 2 1 2 1 2 3 2 2 2 2 1 0 1 0 2 1 1 2 2 2 3 1 1 1 1 1 0 1 2 1 2 2 2 1 1 3 3 3 2 2 ...
output:
? 34 98 40 ? 34 98 87 ? 34 98 4 ? 34 98 10 ? 34 98 64 ? 34 40 87 ? 34 40 4 ? 34 40 10 ? 34 40 64 ? 34 87 4 ? 34 87 10 ? 34 87 64 ? 34 4 10 ? 34 4 64 ? 34 10 64 ? 40 4 10 ? 98 87 4 ? 98 4 10 ? 36 98 87 ? 36 10 34 ? 36 64 34 ? 36 40 4 ? 36 4 64 ? 74 4 10 ? 74 34 64 ? 74 87 36 ? 74 36 64 ? 74 40 10 ? 7...
result:
wrong answer the graph you report is incorrect