QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#117243 | #6668. Trokuti | kshitij_sodani | 0 | 21ms | 7612kb | C++14 | 3.2kb | 2023-06-30 19:16:02 | 2023-06-30 19:16:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define a first
#define b second
#define pb push_back
typedef long long llo;
//#define endl '\n'
int ans[101][101];
int vis[101][101][101];
int val[101][101];
int su=0;
int query(int aa,int bb,int cc){
int x=min(aa,min(bb,cc));
int y=max(aa,max(bb,cc));
int z=aa;
if(z==x or z==y){
z=bb;
}
if(z==x or z==y){
z=cc;
}
if(vis[x][z][y]>=0){
return vis[x][z][y];
}
cout<<"? "<<x+1<<" "<<z+1<<" "<<y+1<<endl;
int xx;
xx=val[x][y]+val[y][z]+val[z][x];;
cin>>xx;
su++;
vis[x][z][y]=xx;
return xx;
}
void set2(int i,int j,int k){
ans[i][j]=k;
ans[j][i]=k;
}
mt19937 rng;
vector<int> cur;
void solve(int i,vector<int> tt){
shuffle(tt.begin(),tt.end(),rng);
vector<pair<int,int>> ee;
for(int j=0;j<tt.size();j+=2){
if(j+1==tt.size()){
set2(i,tt[j],query(cur[0],i,tt[j])-ans[cur[0]][i]-ans[cur[0]][tt[j]]);
}
else{
int x=query(i,tt[j],tt[j+1])-ans[tt[j]][tt[j+1]];
if(x==0){
set2(i,tt[j],0);
set2(i,tt[j+1],0);
}
else if(x==2){
set2(i,tt[j],1);
set2(i,tt[j+1],1);
}
else{
ee.pb({tt[j],tt[j+1]});
}
}
}
if(ee.size()){
vector<int> ff;
for(auto j:ee){
ff.pb(j.a);
}
solve(i,ff);
for(int j=0;j<ee.size();j++){
set2(i,ee[j].b,1-ans[i][ee[j].a]);
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n=100;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
vis[i][j][k]=-1;
}
}
}
rng=mt19937(chrono::steady_clock::now().time_since_epoch().count());
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
val[i][j]=rng()%2;
val[j][i]=val[i][j];
}
}
for(int i=0;i<6;i++){
for(int j=i+1;j<6;j++){
for(int k=j+1;k<6;k++){
query(i,j,k);
//cout<<vis[i][j][k]<<":"<<endl;
if(vis[i][j][k]==0 or vis[i][j][k]==3 and cur.size()==0){
cur.pb(i);
cur.pb(j);
cur.pb(k);
int z=1;
if(vis[i][j][k]==0){
z=0;
}
set2(i,j,z);
set2(i,k,z);
set2(j,k,z);
}
}
}
}
shuffle(cur.begin(),cur.end(),rng);
/*cout<<11<<endl;
for(auto j:cur){
cout<<j<<",";
}
cout<<endl;
return 0;*/
vector<int> tt;
for(int i=0;i<n;i++){
if(i==cur[0] or i==cur[1] or i==cur[2]){
continue;
}
// shuffle(cur.begin(),cur.end(),rng);
int aa=query(i,cur[0],cur[1])-ans[cur[0]][cur[1]];
int bb=query(i,cur[1],cur[2])-ans[cur[1]][cur[2]];
if(aa==0 or aa==2){
set2(i,cur[0],aa/2);
set2(i,cur[1],aa/2);
set2(i,cur[2],bb-(aa/2));
continue;
}
else if(bb==0 or bb==2){
set2(i,cur[1],bb/2);
set2(i,cur[2],bb/2);
set2(i,cur[0],aa-(bb/2));
continue;
}
int cc=query(i,cur[2],cur[0])-ans[cur[2]][cur[0]];
int su=(aa+bb+cc)/2;
set2(i,cur[2],su-aa);
set2(i,cur[0],su-bb);
set2(i,cur[1],su-cc);
}
for(int i=0;i<n;i++){
if(i==cur[0] or i==cur[1] or i==cur[2]){
continue;
}
solve(i,tt);
tt.pb(i);
}
cout<<"!"<<endl;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
// assert(ans[i][j]==val[i][j]);
cout<<ans[i][j];
}
cout<<endl;
}
// cout<<su<<endl;
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 100
Accepted
time: 21ms
memory: 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