QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#186257 | #6668. Trokuti | Cyanmond | 0 | 1ms | 3784kb | C++17 | 3.1kb | 2023-09-23 15:38:49 | 2023-09-23 15:38:49 |
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, l, r) for (int i = (l); i < (r); ++i)
#define per(i, l, r) for (int i = (r - 1); i >= l; --i)
#define ALL(x) (x).begin(), (x).end()
using i64 = long long;
constexpr int N = 6;
int ask(int a, int b, int c) {
cout << "? " << a + 1 << ' ' << b + 1 << ' ' << c + 1 << endl;
int res;
cin >> res;
return res;
}
void main_() {
int ns = 5;
vector<tuple<int, int, int, int>> vs;
rep(i, 0, ns) rep(j, i + 1, ns) rep(k, j + 1, ns) {
const auto res = ask(i, j, k);
vs.push_back({i, j, k, res});
}
vector<vector<int>> edges(N, vector<int>(N, -1));
rep(bits, 0, 1 << (ns * (ns - 1) / 2)) {
vector<vector<int>> edgeV(ns, vector<int>(ns));
rep(i, 0, ns) rep(j, 0, ns) {
const int id = i * (i - 1) / 2 + j;
if (bits & (1 << id)) {
edgeV[i][j] = edgeV[j][i] = 1;
} else {
edgeV[i][j] = edgeV[j][i] = 0;
}
}
bool isOk = true;
for (const auto &[i, j, k, v] : vs) {
const auto sum = edgeV[i][j] + edgeV[j][k] + edgeV[k][i];
if (sum != v) isOk = false;
}
if (isOk) {
rep(i, 0, ns) rep(j, 0, ns) {
edges[i][j] = edgeV[i][j];
}
break;
}
}
rep(i, 0, N) edges[i][i] = 0;
mt19937 mt;
rep(i, ns, N) {
// first check...
const auto x = ask(0, 1, i) - edges[0][1], y = ask(0, 2, i) - edges[0][2], z = ask(1, 2, i) - edges[1][2];
const auto sum = (x + y + z) / 2;
edges[0][i] = edges[i][0] = sum - z;
edges[1][i] = edges[i][1] = sum - y;
edges[2][i] = edges[i][2] = sum - x;
int j = 3;
while (true) {
int f = j;
vector<int> res;
while (true) {
const auto cs = ask(j, (j + 1) % i, i) - edges[j][(j + 1) % i];
j = (j + 1) % i;
res.push_back(cs);
if (cs == 0 or cs == 2) break;
if (j == 0) break;
}
if (res.back() == 0 or res.back() == 2) {
edges[j][i] = edges[i][j] = edges[(j - 1 + i) % i][i] = edges[i][(j - 1 + i) % i] = res.back() / 2;
per(x, 0, (int)res.size() - 1) {
edges[f + x][i] = edges[i][f + x] = res[x] - edges[(f + x + 1) % i][i];
}
} else {
assert(j == 0);
edges[(j - 1 + i) % i][i] = edges[i][(j - 1 + i) % i] = res.back() - edges[i][j];
per(x, 0, (int)res.size() - 1) {
edges[f + x][i] = edges[i][f + x] = res[x] - edges[(f + x + 1) % i][i];
}
}
if (j == 0) break;
j = (j + 1) % i;
if (j == 0) break;
}
}
cout << "!" << endl;
rep(i, 0, N) {
rep(j, 0, N) {
cout << edges[i][j];
}
cout << '\n';
}
cout << flush;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
main_();
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3784kb
input:
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 ? 1 2 6 ? 1 3 6 ? 2 3 6 ? 4 5 6 ! 000000 000000 000000 000000 000000 000000
result:
wrong answer Token parameter [name=ans_i] equals to "000000", doesn't correspond to pattern "[01]{100,100}"