QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#305758 | #6668. Trokuti | Huasushis | 0 | 17ms | 3776kb | C++14 | 2.8kb | 2024-01-15 23:25:26 | 2024-01-15 23:25:26 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int n = 100;
int a[110][110];
int fc[15];
int tmp[6][6], tot;
int fa[210];
int getfa(int v) {
return v == fa[v] ? v : fa[v] = getfa(fa[v]);
}
int main() {
ios::sync_with_stdio(false);
for (int i = 1; i <= 5; ++i) {
for (int j = i + 1; j <= 5; ++j) {
tmp[i][j] = ++tot;
}
}
tot = 0;
for (int i = 1; i <= 5; ++i) {
for (int j = i + 1; j <= 5; ++j) {
for (int k = j + 1; k <= 5; ++k) {
++tot;
cout << "? " << i << ' ' << j << ' ' << k << endl;
int bs = 0;
cin >> bs;
fc[tot] = bs;
}
}
}
for (int mj = 0; mj < (1 << 10); ++mj) {
int ls[11];
for (int j = 1; j <= 10; ++j) ls[j] = (mj >> (j - 1)) & 1;
tot = 0;
for (int i = 1; i <= 5; ++i) {
for (int j = i + 1; j <= 5; ++j) {
for (int k = j + 1; k <= 5; ++k) {
++tot;
if (ls[tmp[i][j]] + ls[tmp[i][k]] + ls[tmp[j][k]] != fc[tot]) goto nxt;
}
}
}
for (int i = 1; i <= 5; ++i) {
for (int j = i + 1; j <= 5; ++j) {
a[i][j] = ls[tmp[i][j]];
a[j][i] = a[i][j];
}
}
break;
nxt:;
if (mj + 1 == (1 << 10)) exit(114);
}
for (int i = 6; i <= n; ++i) {
const int li = i, yi = i + i;
int ltk = i - 1;
static mt19937 mt(19260817 ^ 19491001);
iota(fa + 1, fa + i * 2 + 1, 1);
while (ltk) {
int u = mt() % (i - 1) + 1, v = mt() % (i - 1) + 1;
if (getfa(u) == getfa(v)) continue;
if (ltk > 1) {
if (getfa(u) == getfa(li)) continue;
if (getfa(u) == getfa(yi)) continue;
if (getfa(v) == getfa(li)) continue;
if (getfa(v) == getfa(yi)) continue;
}
cout << "? " << i << ' ' << u << ' ' << v << endl;
int bs = 0;
cin >> bs;
bs -= a[u][v];
switch (bs) {
case 0: {
if (getfa(u) == getfa(li) || getfa(v) == getfa(li)) ++ltk;
fa[getfa(u)] = fa[getfa(v)] = getfa(li);
fa[getfa(u + i)] = fa[getfa(v + i)] = getfa(yi);
ltk -= 2;
break;
}
case 1: {
fa[getfa(u)] = getfa(v + i);
fa[getfa(v)] = getfa(u + i);
--ltk;
break;
}
case 2: {
if (getfa(u) == getfa(yi) || getfa(v) == getfa(yi)) ++ltk;
fa[getfa(u)] = fa[getfa(v)] = getfa(yi);
fa[getfa(u + i)] = fa[getfa(v + i)] = getfa(li);
ltk -= 2;
break;
}
}
}
for (int j = 1; j < i; ++j) {
a[i][j] = a[j][i] = getfa(j) == getfa(yi);
}
}
cout << "!" << endl;
for (int i = 1; i <= 100; ++i) {
for (int j = 1; j <= 100; ++j) {
cout << a[i][j];
}
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: 17ms
memory: 3688kb
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 ? 6 2 1 ? 6 5 4 ? 6 5 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