QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#186260 | #6668. Trokuti | Cyanmond | 0 | 13ms | 3672kb | C++17 | 3.7kb | 2023-09-23 15:41:31 | 2023-09-23 15:41:31 |
Judging History
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 = 100;
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...
int j = -1;
const auto x = ask(0, 1, i) - edges[0][1];
if (x == 0 or x == 2) {
edges[0][i] = edges[i][0] = x / 2;
edges[1][i] = edges[i][1] = x / 2;
j = 2;
} else {
const auto y = ask(0, 2, i) - edges[0][2];
if (y == 0 or y == 2) {
edges[0][i] = edges[i][0] = edges[2][i] = edges[i][2] = y / 2;
edges[1][i] = edges[i][1] = x - edges[0][i];
j = 3;
} else {
const auto z = ask(1, 2, i) - edges[i][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;
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: 100
Accepted
time: 13ms
memory: 3572kb
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 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? 3 4 11 ? 5 6 11 ? 7 8 11 ? 9 10 11 ? 1 2 12 ? 3 4 12...
result:
wrong answer Token parameter [name=ans_i] equals to "000000000000000000000000000000...-200000000000000000000000000000", doesn't correspond to pattern "[01]{100,100}"