QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#126188 | #6668. Trokuti | lhcqwq | 0 | 23ms | 3488kb | C++14 | 1.7kb | 2023-07-18 11:06:07 | 2023-07-18 11:06:10 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int edge[N][N];
int num[6][6][6];
int query(int a,int b,int c){cout<<"? "<<a<<" "<<b<<" "<<c<<endl;int x;cin>>x;return x;}
bool dfs(int i,int j)
{
if(i == 6)
{
for(int i = 1;i <= 5;i++)
for(int j = i+1;j <= 5;j++)
for(int k = j+1;k <= 5;k++)
if(edge[i][j]+edge[i][k]+edge[j][k] != num[i][j][k]) return false;
return true;
}
if(j == 6) return dfs(i+1,1);
if(i >= j)
{
edge[i][j] = edge[j][i];
return dfs(i,j+1);
}
edge[i][j] = 0;
if(dfs(i,j+1)) return true;
edge[i][j] = 1;
return dfs(i,j+1);
}
void cnct(int i,int j){edge[i][j]=edge[j][i]=1;}
int qans[N],lft,cnt;
int main()
{
for(int i = 1;i <= 5;i++)
for(int j = i+1;j <= 5;j++)
for(int k = j+1;k <= 5;k++)
num[i][j][k] = query(i,j,k);
dfs(1,1);
for(int t = 6;t <= 100;t++)
{
cnt = 0;
for(int i = 1;i <= t-2;i++)
{
qans[++cnt] = query(i,i+1,t)-edge[i][i+1];
if(qans[cnt] == 1) continue;
if(qans[cnt] == 2) cnct(i,t),cnct(i+1,t);
int pos = i-1;
while(--cnt)
{
if(qans[cnt] > edge[pos+1][t]) cnct(pos,t);
pos--;
}
i++;
}
if(cnt != 0)
{
if(cnt&1)
{
if(query(t-cnt,t-1,t)-edge[t-cnt][t-1] == 2) cnct(t-1,t);
int pos = t-2;cnt++;
while(--cnt)
{
if(qans[cnt] > edge[pos+1][t]) cnct(pos,t);
pos--;
}
}
else
{
if(query(t-cnt-1,t-1,t)-edge[t-cnt-1][t-1] == 2) cnct(t-1,t);
int pos = t-2;cnt++;
while(--cnt)
{
if(qans[cnt] > edge[pos+1][t]) cnct(pos,t);
pos--;
}
}
}
}
cout << "!\n";
for(int i = 1;i <= 100;i++)
{
for(int j = 1;j <= 100;j++) cout << edge[i][j];
cout << "\n";
}
cout << endl;
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: 5ms
memory: 3488kb
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 2 3 ? 1 2 4 ? 1 2 5 ? 1 3 4 ? 1 3 5 ? 1 4 5 ? 2 3 4 ? 2 3 5 ? 2 4 5 ? 3 4 5 ? 1 2 6 ? 3 4 6 ? 1 2 7 ? 3 4 7 ? 5 6 7 ? 1 2 8 ? 3 4 8 ? 5 6 8 ? 1 2 9 ? 3 4 9 ? 5 6 9 ? 7 8 9 ? 1 2 10 ? 3 4 10 ? 5 6 10 ? 7 8 10 ? 1 2 11 ? 3 4 11 ? 5 6 11 ? 7 8 11 ? 9 10 11 ? 1 2 12 ? 3 4 12 ? 5 6 12 ? 7 8 12 ? 9 10...
result:
points 1.0 points 1.0 correct 2456 queries
Test #2:
score: 0
Wrong Answer
time: 23ms
memory: 3408kb
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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