QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#126332 | #6668. Trokuti | angry_face | Compile Error | / | / | C++14 | 3.2kb | 2023-07-18 13:00:19 | 2023-07-18 13:00:26 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-18 13:00:26]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-07-18 13:00:19]
- 提交
answer
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <iostream>
using namespace std;
const int NR=110;
int f[NR][NR][NR];
int mp[NR][NR],c[NR*NR];
int check(int x,int y,int z)
{
int ans=0;
printf("? %d %d %d\n",x,y,z);
cout.flush();
scanf("%d",&ans);
return ans;
}
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(mp[i][j]+mp[i][k]+mp[j][k] != f[i][j][k]) return false;
return true;
}
if(j == 6) return dfs(i+1,1);
if(i >= j)
{
mp[i][j] = mp[j][i];
return dfs(i,j+1);
}
mp[i][j] = 0;
if(dfs(i,j+1)) return true;
mp[i][j] = 1;
return dfs(i,j+1);
}
void cnct(int i,int j){mp[i][j]=mp[j][i]=1;}
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++)
{
f[i][j][k]=check(i,j,k);
}
}
}
/*for(int s=0;s<(1<<10);s++)
{
int cur=0;
for(int j=1;j<=5;j++)
{
for(int k=j+1;k<=5;k++)
{
if((s&(1<<cur))==0) mp[j][k]=mp[k][j]=0;
else mp[j][k]=mp[k][j]=1;
cur++;
}
}
bool flag=true;
for(int i=1;i<=5;i++)
{
for(int j=i+1;j<=5;j++)
{
for(int k=j+1;k<=5;k++)
{
int now=0;
if(mp[i][j]==1) now++;
if(mp[i][k]==1) now++;
if(mp[j][k]==1) now++;
if(now!=f[i][j][k]) flag=false;
}
}
}
if(flag==true) break;
}*/
dfs(1,1);
/*for(int i=6;i<=100;i++)
{
int cnt=0;
for(int j=1;j<=i-2;j++)
{
c[++cnt]=check(i,j,j+1)-mp[j][j+1];
if(c[cnt]==1) continue;
if(c[cnt]==2) mp[i][j]=mp[j][i]=mp[j+1][i]=mp[i][j+1]=1;
int now=j-1;
for(int k=cnt-1;k>=1;k--) if(c[k]>mp[now+1][i]) mp[now][i]=mp[i][now--]=1;
j++;
if(j==i-2) if(check(i-2,i-1,i)-mp[i-2][i-1]-mp[i-2][i]!=0) mp[i-1][i]=mp[i][i-1]=1;
}
if(cnt!=0)
{
if(cnt%2==1)
{
if(check(i,i-1,i-cnt)-mp[i-1][i-cnt]==2) mp[i][i-1]=mp[i-1][i]=1;
cnt++;
int now=i-2;
for(int k=cnt-1;k>=1;k--) if(c[k]>mp[now+1][i]) mp[now][i]=mp[i][now--]=1;
}
else
{
if(check(i,i-1,i-cnt-1)-mp[i-1][i-cnt-1]==2) mp[i][i-1]=mp[i-1][i]=1;
cnt++;
int now=i-2;
for(int k=cnt-1;k>=1;k--) if(c[k]>mp[now+1][i]) mp[now][i]=mp[i][now--]=1;
}
}
}*/
for(int t = 6;t <= 100;t++)
{
cnt = 0;
for(int i = 1;i <= t-2;i++)
{
c[++cnt] = check(i,i+1,t)-mp[i][i+1];
if(c[cnt] == 1) continue;
if(c[cnt] == 2) cnct(i,t),cnct(i+1,t);
int pos = i-1;
while(--cnt)
{
if(c[cnt] > mp[pos+1][t]) cnct(pos,t);
pos--;
}
i++;
if(i == t-2) if(check(t-2,t-1,t)-mp[t-2][t-1]-mp[t-2][t]) cnct(t-1,t);
}
if(cnt != 0)
{
if(cnt&1)
{
if(check(t-cnt,t-1,t)-mp[t-cnt][t-1] == 2) cnct(t-1,t);
int pos = t-2;cnt++;
while(--cnt)
{
if(c[cnt] > mp[pos+1][t]) cnct(pos,t);
pos--;
}
}
else
{
if(check(t-cnt-1,t-1,t)-mp[t-cnt-1][t-1] == 2) cnct(t-1,t);
int pos = t-2;cnt++;
while(--cnt)
{
if(c[cnt] > mp[pos+1][t]) cnct(pos,t);
pos--;
}
}
}
}
printf("!\n");
for(int i=1;i<=100;i++)
{
for(int j=1;j<=100;j++)
{
printf("%d",mp[i][j]);
}
puts("");
}
return 0;
}
詳細信息
answer.code: In function ‘int main()’: answer.code:121:17: error: ‘cnt’ was not declared in this scope; did you mean ‘int’? 121 | cnt = 0; | ^~~ | int answer.code: In function ‘int check(int, int, int)’: answer.code:19:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%d",&ans); | ~~~~~^~~~~~~~~~~