QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#117097 | #6668. Trokuti | tricyzhkx# | 0 | 0ms | 3980kb | C++14 | 2.4kb | 2023-06-30 12:53:32 | 2024-05-31 18:41:54 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
const int N=100;
typedef vector<int> vi;
int G[110][110],id[10][10],a[110],Q[20][3];
map<vector<int>,int> mp;
mt19937 Rand(0);
int query(int a,int b,int c)
{
printf("? %d %d %d\n",a,b,c);fflush(stdout);
int x;scanf("%d",&x);
return x;
}
int query2(int a,int b,int c){return query(a,b,c)-G[b][c];}
vi Set(int l,int r)
{
vi T(r-l+1);
iota(T.begin(),T.end(),l);
return T;
}
void solve(const vi &S)
{
assert(S.size()==5);
vector<int> vec;
for(int i=0;i<9;i++) vec.push_back(query(S[Q[i][0]],S[Q[i][1]],S[Q[i][2]]));
int T=mp[vec];
for(int i=0,k=0;i<5;i++)
for(int j=0;j<i;j++)
G[S[i]][S[j]]=G[S[j]][S[i]]=(T>>(k++))&1;
}
void solve2(const vi &S)
{
assert(S.size()==5*5);
for(int i=0;i<5;i++)
for(int j=0;j<5;j++)
{
vi T(5);
for(int k=0;k<5;k++) T[k]=S[5*k+(i*k+j)%5];
solve(T);
}
for(int i=0;i<5;i++)
{
vi T(5);
for(int j=0;j<5;j++) T[j]=S[5*i+j];
solve(T);
}
}
void solve3(int u,vi S)
{
int n=S.size();assert(n&1);
shuffle(S.begin(),S.end(),Rand);
vi T;T.push_back(S[0]);T.push_back(S[1]);T.push_back(S[2]);
fill(a,a+n,-1);
for(int i=3;i<n;i+=2)
{
int t=query2(u,S[i],S[i+1]);
if(t!=1) G[u][S[i]]=G[S[i]][u]=G[u][S[i+1]]=G[S[i+1]][u]=t/2;
else a[T.size()]=t,T.push_back(S[i]),T.push_back(S[i+1]);
}
swap(S,T);n=S.size();
for(int i=0;i<n-1;i++)
if(a[i]<0) a[i]=query2(u,S[i],S[i+1]);
a[n-1]=query2(u,S[n-1],S[0]);
int p=-1;
for(int i=0;i<n;i++)
if(a[i]!=1) p=i;
assert(p>=0);
G[u][S[p]]=G[S[p]][u]=a[p]/2;
for(int i=p-1;i>=0;i--) G[u][S[i]]=G[S[i]][u]=a[i]-G[u][S[i+1]];
for(int i=p;i<n-1;i++) G[u][S[i+1]]=G[S[i+1]][u]=a[i]-G[u][S[i]];
}
int main()
{
int tot=0;
for(int i=0;i<5;i++)
for(int j=i+1;j<5;j++)
for(int k=j+1;k<5;k++)
Q[tot][0]=i,Q[tot][1]=j,Q[tot][2]=k,tot++;
for(int i=0,k=0;i<5;i++)
for(int j=0;j<i;j++)
id[i][j]=id[j][i]=k++;
for(int i=0;i<(1<<10);i++)
{
vector<int> vec;
auto g=[&](int u,int v){return (i>>id[u][v])&1;};
for(int j=0;j<9;j++)
vec.push_back(g(Q[j][0],Q[j][1])+g(Q[j][1],Q[j][2])+g(Q[j][2],Q[j][0]));
mp[vec]=i;
}
for(int i=1;i<=4;i++) solve2(Set(25*(i-1)+1,25*i));
for(int i=1;i<4;i++)
for(int j=i+1;j<=4;j++)
for(int k=1;k<=25;k++)
solve3(25*(i-1)+k,Set(25*(j-1)+1,25*j));
for(int i=1;i<=N;i++,puts(""))
for(int j=1;j<=N;j++)
putchar(G[i][j]+'0');
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3980kb
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:
? 1 6 11 ? 1 6 16 ? 1 6 21 ? 1 11 16 ? 1 11 21 ? 1 16 21 ? 6 11 16 ? 6 11 21 ? 6 16 21 ? 2 7 12 ? 2 7 17 ? 2 7 22 ? 2 12 17 ? 2 12 22 ? 2 17 22 ? 7 12 17 ? 7 12 22 ? 7 17 22 ? 3 8 13 ? 3 8 18 ? 3 8 23 ? 3 13 18 ? 3 13 23 ? 3 18 23 ? 8 13 18 ? 8 13 23 ? 8 18 23 ? 4 9 14 ? 4 9 19 ? 4 9 24 ? 4 14 19 ? ...
result:
wrong answer unknown token 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000