QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#116930 | #6668. Trokuti | He_Ren# | 0 | 8ms | 4168kb | C++17 | 3.3kb | 2023-06-30 10:54:33 | 2024-05-31 18:35:01 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 100 + 5;
mt19937 gen(114514);
int ask(int x,int y,int z)
{
printf("? %d %d %d\n",x,y,z);
fflush(stdout);
int res;
scanf("%d",&res);
return res;
}
int n;
int ans[MAXN][MAXN];
array<int,3> rt = {0,0,0};
void updans(int u,int v,int w)
{
ans[u][v] = ans[v][u] = w;
}
int ask(int u,int v)
{
if(ans[u][v] != -1) return ans[u][v];
int k = ask(u, v, rt[0]) - ans[u][rt[0]] - ans[v][rt[0]];
updans(u, v, k);
return k;
}
int ask_all(int u,int v,int w)
{
int t = ask(u, v, w);
if(t == 0 || t == 3)
{
t /= 3;
updans(u, v, t);
updans(u, w, t);
updans(v, w, t);
return ans[u][v] + ans[u][w] + ans[v][w];
}
t = t - ask(u, v);
if(t == 0 || t == 2)
{
t /= 2;
updans(u, w, t);
updans(v, w, t);
return ans[u][v] + ans[u][w] + ans[v][w];
}
t = t - ask(u, w);
updans(v, w, t);
return ans[u][v] + ans[u][w] + ans[v][w];
}
void check(int u,int v,int w,int oth)
{
int x01 = ask(u, v, oth) - ans[u][v];
if(x01 == 0 || x01 == 2)
{
updans(u, oth, x01 / 2);
updans(v, oth, x01 / 2);
int x02 = ask(u, w, oth) - ans[u][w];
updans(w, oth, x02 - ans[u][oth]);
return;
}
int x02 = ask(u, w, oth) - ans[u][w];
if(x02 == 0 || x02 == 2)
{
updans(u, oth, x02 / 2);
updans(w, oth, x02 / 2);
updans(v, oth, x01 - ans[oth][u]);
return;
}
int x12 = ask(v, w, oth) - ans[v][w];
updans(v, oth, x12 / 2);
updans(w, oth, x12 / 2);
updans(u, oth, x01 - ans[oth][v]);
}
int main(void)
{
n = 100;
memset(ans, -1, sizeof(ans));
for(int i=1; i<=n; ++i)
ans[i][i] = 0;
vector<int> id(n);
iota(id.begin(), id.end(), 1);
shuffle(id.begin(), id.end(), gen);
[&] (void)
{
for(int i=0; i<n; ++i)
for(int j=0; j<i; ++j)
for(int k=0; k<j; ++k)
{
int t = ask(id[i], id[j], id[k]);
if(t == 0 || t == 3)
{
int cur = t / 3;
updans(id[i], id[j], cur);
updans(id[i], id[k], cur);
updans(id[j], id[k], cur);
rt = {id[i], id[j], id[k]};
return;
}
}
}();
for(auto t: rt)
id.erase(find(id.begin(), id.end(), t));
for(auto t: id)
{
check(rt[0], rt[1], rt[2], t);
}
vector<int> has;
for(auto u: id)
{
pii lst = {0,0};
int i = 0;
shuffle(has.begin(), has.end(), gen);
for(; i+1 < (int)has.size(); i+=2)
{
int v = has[i], w = has[i+1];
int t = ask(u, v, w) - ans[v][w];
if(t == 0 || t == 2)
{
updans(u, v, t / 2);
updans(u, w, t / 2);
continue;
}
if(lst.first)
{
t = ask(u, v, lst.first);
if(t == 0 || t == 2)
{
t /= 2;
updans(u, v, t);
updans(u, lst.first, t);
updans(u, w, t ^ 1);
updans(u, lst.second, t ^ 1);
}
else
{
t = ask(u, v);
updans(u, w, t ^ 1);
updans(u, lst.first, t ^ 1);
updans(u, lst.second, t);
}
lst = {0,0};
}
else lst = {v, w};
}
if(i < (int)has.size())
ask(u, has[i]);
if(lst.first)
{
ask(u, lst.first);
updans(u, lst.second, ans[u][lst.first] ^ 1);
}
has.emplace_back(u);
}
printf("!\n");
for(int i=1; i<=n; ++i, printf("\n"))
for(int j=1; j<=n; ++j)
printf("%d",ans[i][j]);
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 100
Accepted
time: 0ms
memory: 3880kb
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:
? 100 40 93 ? 100 40 36 ? 100 93 36 ? 100 40 2 ? 100 93 2 ? 100 40 23 ? 100 93 23 ? 100 40 77 ? 100 93 77 ? 100 40 87 ? 100 93 87 ? 100 40 10 ? 100 93 10 ? 100 40 70 ? 100 93 70 ? 100 40 13 ? 100 93 13 ? 100 40 65 ? 100 93 65 ? 100 40 83 ? 100 93 83 ? 100 40 20 ? 100 93 20 ? 100 40 15 ? 100 93 15 ? ...
result:
points 1.0 points 1.0 correct 2547 queries
Test #2:
score: 100
Accepted
time: 0ms
memory: 4168kb
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:
? 100 40 93 ? 100 40 36 ? 100 93 36 ? 100 40 2 ? 100 93 2 ? 100 40 23 ? 100 93 23 ? 100 40 77 ? 100 93 77 ? 100 40 87 ? 100 93 87 ? 100 40 10 ? 100 93 10 ? 100 40 70 ? 100 93 70 ? 100 40 13 ? 100 93 13 ? 100 40 65 ? 100 93 65 ? 100 40 83 ? 100 93 83 ? 100 40 20 ? 100 93 20 ? 100 40 15 ? 100 93 15 ? ...
result:
points 1.0 points 1.0 correct 2547 queries
Test #3:
score: 100
Accepted
time: 0ms
memory: 3812kb
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:
? 100 40 93 ? 100 40 36 ? 100 93 36 ? 100 40 2 ? 100 93 2 ? 100 40 23 ? 100 93 23 ? 100 40 77 ? 100 93 77 ? 100 40 87 ? 100 93 87 ? 100 40 10 ? 100 93 10 ? 100 40 70 ? 100 93 70 ? 100 40 13 ? 100 93 13 ? 100 40 65 ? 100 93 65 ? 100 40 83 ? 100 93 83 ? 100 40 20 ? 100 93 20 ? 100 40 15 ? 100 93 15 ? ...
result:
points 1.0 points 1.0 correct 2548 queries
Test #4:
score: 100
Accepted
time: 8ms
memory: 4128kb
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:
? 100 40 93 ? 100 40 36 ? 100 93 36 ? 100 40 2 ? 100 93 2 ? 100 40 23 ? 100 93 23 ? 100 40 77 ? 100 93 77 ? 100 40 87 ? 100 93 87 ? 100 40 10 ? 100 93 10 ? 100 40 70 ? 100 93 70 ? 100 40 13 ? 100 93 13 ? 100 40 65 ? 100 93 65 ? 100 40 83 ? 100 93 83 ? 100 40 20 ? 100 93 20 ? 100 40 15 ? 100 93 15 ? ...
result:
points 1.0 points 1.0 correct 2548 queries
Test #5:
score: 100
Accepted
time: 8ms
memory: 3876kb
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:
? 100 40 93 ? 100 40 36 ? 100 93 36 ? 100 40 2 ? 100 93 2 ? 100 40 23 ? 100 93 23 ? 100 40 77 ? 100 93 77 ? 100 40 87 ? 100 93 87 ? 100 40 10 ? 100 93 10 ? 100 40 70 ? 100 93 70 ? 100 40 13 ? 100 93 13 ? 100 40 65 ? 100 93 65 ? 100 40 83 ? 100 93 83 ? 100 40 20 ? 100 93 20 ? 100 40 15 ? 100 93 15 ? ...
result:
points 1.0 points 1.0 correct 2557 queries
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 4132kb
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 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 2 2 3 3 3 3 3 ...
output:
? 100 40 93 ? 100 40 36 ? 100 93 36 ? 100 40 2 ? 100 93 2 ? 100 40 23 ? 100 93 23 ? 100 40 77 ? 100 93 77 ? 100 40 87 ? 100 93 87 ? 100 40 10 ? 100 93 10 ? 100 40 70 ? 100 93 70 ? 100 40 13 ? 100 93 13 ? 100 40 65 ? 100 93 65 ? 100 40 83 ? 100 93 83 ? 100 40 20 ? 100 93 20 ? 100 40 15 ? 100 93 15 ? ...
result:
wrong answer the graph you report is incorrect