QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#519900#6668. Trokutibykem0 11ms3828kbC++203.1kb2024-08-15 09:19:462024-08-15 09:19:46

Judging History

你现在查看的是最新测评结果

  • [2024-08-15 09:19:46]
  • 评测
  • 测评结果:0
  • 用时:11ms
  • 内存:3828kb
  • [2024-08-15 09:19:46]
  • 提交

answer

#include <algorithm>
#include <chrono>
#include <iostream>
#include <random>
#include <vector>

using namespace std;

mt19937 rnd(chrono::steady_clock().now().time_since_epoch().count());

const int kN = 101;
const int kM[10][10] = {{2, 2, 2, -1, -1, -1, -1, -1, -1, 2}, {2, -1, -1, 2, 2, -1, -1, -1, 2, -1}, {-1, 2, -1, 2, -1, 2, -1, 2, -1, -1}, {-1, -1, 2, -1, 2, 2, 2, -1, -1, -1}, {2, -1, -1, -1, -1, 2, 2, 2, -1, -1}, {-1, 2, -1, -1, 2, -1, 2, -1, 2, -1}, {-1, -1, 2, 2, -1, -1, -1, 2, 2, -1}, {-1, -1, 2, 2, -1, -1, 2, -1, -1, 2}, {-1, 2, -1, -1, 2, -1, -1, 2, -1, 2}, {2, -1, -1, -1, -1, 2, -1, -1, 2, 2}};

int n = kN - 1;
bool e[kN][kN];
vector<int> p;
int b[10];

int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  for (int i = 1, c = 0; i <= 5; ++i) {
    for (int j = i + 1; j <= 5; ++j) {
      for (int k = j + 1; k <= 5; ++k) {
        cout << "? " << i << ' ' << j << ' ' << k << endl;
        cin >> b[c++];
      }
    }
  }
  for (int i = 1, c = 0; i <= 5; ++i) {
    for (int j = i + 1; j <= 5; ++j) {
      int s = 0;
      for (int k = 0; k < 10; ++k) {
        s += b[k] * kM[c][k];
      }
      e[i][j] = e[j][i] = s / 6;
      ++c;
    }
  }
  p = {1, 2, 3, 4, 5};
  for (int i = 6; i <= n; ++i) {
    shuffle(p.begin(), p.end(), rnd);
    int j = 0;
    for (; j + 1 < p.size();) {
      int r = j;
      for (; r + 1 < p.size(); ++r) {
        cout << "? " << i << ' ' << p[r] << ' ' << p[r + 1] << endl;
        int v;
        cin >> v;
        v -= e[p[r]][p[r + 1]];
        if (v != 1) {
          e[i][p[r]] = e[i][p[r + 1]] = v / 2;
          e[p[r]][i] = e[p[r + 1]][i] = v / 2;
          break;
        }
      }
      if (r == p.size() - 1) {
        cout << "? " << i << ' ' << p[0] << ' ' << p[2] << endl;
        int v;
        cin >> v;
        v -= e[p[0]][p[2]];
        for (int k = 0; k < p.size(); ++k) {
          e[i][p[k]] = e[p[k]][i] = (v / 2) ^ (k & 1);
        }
        break;
      }
      for (int k = r; k > j; --k) {
        e[i][p[k - 1]] = e[p[k - 1]][i] = !e[i][p[k]];
      }
      j = r + 2;
    }
    if (j == p.size() - 1) {
      cout << "? " << i << ' ' << p[0] << ' ' << p[j] << endl;
      int v;
      cin >> v;
      e[i][p[j]] = e[p[j]][i] = v - e[i][p[0]] - e[p[0]][p[j]];
    }
    p.push_back(i);
  }
  cout << '!' << endl;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cout << e[i][j];
    }
    cout << '\n';
  }
  cout.flush();
  return 0;
}
/*
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) (1,3) (1,4) (1,5) (2,3) (2,4) (2,5) (3,4) (3,5) (4,5)
  1     1                 1
  1           1                 1
  1                 1                 1
        1     1                             1
        1           1                             1
              1     1                                   1
                          1     1           1
                          1           1           1
                                1     1                 1
                                            1     1     1


*/

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 100
Accepted
time: 11ms
memory: 3688kb

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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 5
? 11 3 1
? 11 4 7
? 11 8 9
? 11 10 6
? 11 2 5
? 12 3 4
? 12 10 ...

result:

points 1.0 points  1.0 correct 2504 queries

Test #3:

score: 100
Accepted
time: 0ms
memory: 3776kb

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 4 5
? 6 3 1
? 6 4 2
? 7 4 1
? 7 3 2
? 7 6 5
? 8 4 5
? 8 7 6
? 8 3 2
? 8 4 1
? 9 8 1
? 9 2 5
? 9 7 4
? 9 6 3
? 10 5 9
? 10 2 3
? 10 7 4
? 10 1 6
? 10 5 8
? 11 4 9
? 11 5 8
? 11 1 6
? 11 2 10
? 11 7 3
? 12 1 6
? 12 5 7...

result:

points 1.0 points  1.0 correct 2505 queries

Test #4:

score: 100
Accepted
time: 4ms
memory: 3692kb

input:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

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 5 1
? 6 4 3
? 6 5 2
? 7 2 4
? 7 6 3
? 7 1 5
? 8 1 4
? 8 7 3
? 8 5 2
? 8 1 6
? 9 7 8
? 9 6 2
? 9 4 1
? 9 5 3
? 10 3 1
? 10 9 2
? 10 7 5
? 10 8 4
? 10 3 6
? 11 5 1
? 11 3 6
? 11 8 10
? 11 4 7
? 11 9 2
? 12 7 5
? 12 4 9...

result:

points 1.0 points  1.0 correct 2504 queries

Test #5:

score: 0
Wrong Answer
time: 3ms
memory: 3828kb

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
1
1
0
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 4 2
? 6 3 5
? 6 4 1
? 7 6 3
? 7 4 5
? 7 2 1
? 8 5 2
? 8 7 6
? 8 4 1
? 8 5 3
? 9 8 3
? 9 7 2
? 9 5 1
? 9 6 4
? 10 1 2
? 10 7 3
? 10 8 9
? 10 5 6
? 10 1 4
? 11 2 9
? 11 10 5
? 11 8 1
? 11 4 6
? 11 7 3
? 12 11 7
? 12 4 ...

result:

wrong answer the graph you report is incorrect