QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#124318 | #6668. Trokuti | bashkort# | 0 | 12ms | 8164kb | C++20 | 2.7kb | 2023-07-14 16:49:32 | 2024-07-04 00:40:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
mt19937 rnd(228);
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n = 100;
#ifdef __APPLE__
cin >> n;
#endif
vector mp(n, vector(n, vector<int>(n, -1)));
vector e(n, vector<int>(n, -1));
for (int i = 0; i < n; ++i) {
e[i][i] = 0;
}
auto ask = [&](array<int, 3> a) {
sort(a.begin(), a.end());
if (mp[a[0]][a[1]][a[2]] == -1) {
cout << "? " << a[0] + 1 << " " << a[1] + 1 << " " << a[2] + 1 << endl;
cin >> mp[a[0]][a[1]][a[2]];
int x = mp[a[0]][a[1]][a[2]];
if (x == 0 || x == 3) {
for (int i = 0; i < 3; ++i) {
for (int j = i + 1; j < 3; ++j) {
e[i][j] = bool(x);
}
}
}
}
return mp[a[0]][a[1]][a[2]];
};
int qwq = 1;
array<int, 3> t{};
for (; qwq <= 1e4; ++qwq) {
array<int, 3> a{};
for (int i = 0; i < 3; ++i) {
a[i] = rnd() % n;
bool ok = true;
for (int j = 0; j < i; ++j) {
ok &= a[i] != a[j];
}
if (!ok) {
i -= 1;
}
}
if (int x = ask(a); x == 0 || x == 3) {
t = a;
for (int i = 0; i < 3; ++i) {
for (int j = i + 1; j < 3; ++j) {
e[a[i]][a[j]] = e[a[j]][a[i]] = bool(x);
}
}
break;
}
}
for (int x = 0; x < n; ++x) {
if (find(t.begin(), t.end(), x) != t.end()) {
continue;
}
vector<pair<int, int>> o{{0, 1}, {0, 2}, {1, 2}};
// shuffle(o.begin(), o.end(), rnd);
for (auto [i, j] : o) {
int c = ask({x, t[i], t[j]});
if (c - e[t[i]][t[j]] == 0 || c - e[t[i]][t[j]] == 2) {
e[t[i]][x] = e[t[j]][x] = e[x][t[i]] = e[x][t[j]] = c > e[t[i]][t[j]];
int oth = t[3 ^ i ^ j];
e[oth][x] = e[x][oth] = ask({x, t[i], oth}) - e[x][t[i]] - e[t[i]][oth];
break;
}
}
}
for (int i = 0; i < n; ++i) {
for (int j = i + 1; j < n; ++j) {
if (e[i][j] == -1) {
e[i][j] = e[j][i] = ask({i, j, t[0]}) - e[i][t[0]] - e[j][t[0]];
}
}
}
cout << "!\n";
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
cout << e[i][j];
}
cout << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 12ms
memory: 8164kb
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:
? 74 76 97 ? 1 74 97 ? 1 74 76 ? 2 74 97 ? 2 74 76 ? 3 74 97 ? 3 74 76 ? 4 74 97 ? 4 74 76 ? 5 74 97 ? 5 74 76 ? 6 74 97 ? 6 74 76 ? 7 74 97 ? 7 74 76 ? 8 74 97 ? 8 74 76 ? 9 74 97 ? 9 74 76 ? 10 74 97 ? 10 74 76 ? 11 74 97 ? 11 74 76 ? 12 74 97 ? 12 74 76 ? 13 74 97 ? 13 74 76 ? 14 74 97 ? 14 74 76...
result:
wrong answer Token parameter [name=ans_i] equals to "-10000000000000000000000000000...0000000000000000000000000000000", doesn't correspond to pattern "[01]{100,100}"