QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#186245 | #6668. Trokuti | Cyanmond | 0 | 1ms | 3524kb | C++17 | 2.8kb | 2023-09-23 15:20:31 | 2023-09-23 15:20:32 |
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;
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;
for (int j = 3; j < i; j += 2) {
if (j == i - 1) {
const auto x = ask(0, j, i) - edges[0][j] - edges[0][i];
edges[j][i] = edges[i][j] = x;
} else {
const auto x = ask(j, j + 1, i) - edges[j][j + 1];
if (x == 0) {
edges[j][i] = edges[i][j] = edges[j + 1][i] = edges[i][j + 1] = 0;
} else if (x == 2) {
edges[j][i] = edges[i][j] = edges[j + 1][i] = edges[i][j + 1] = 1;
} else {
const auto y = ask(0, j, i) - edges[0][j] - edges[0][i];
edges[j][i] = edges[i][j] = y;
edges[j + 1][i] = edges[i][j + 1] = x - y;
}
}
}
}
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: 3524kb
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}"