QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#305759 | #6668. Trokuti | Huasushis | 0 | 17ms | 3752kb | C++14 | 2.8kb | 2024-01-15 23:27:46 | 2024-01-15 23:27:46 |
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:;
}
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) || getfa(u) == getfa(v + i)) 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 <= n; ++i) {
for (int j = 1; j <= n; ++j) {
cout << a[i][j];
}
cout << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Time Limit Exceeded
Test #1:
score: 100
Accepted
time: 17ms
memory: 3744kb
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 3 ? 7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