QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519868#6668. Trokutibykem0 13ms3624kbC++202.9kb2024-08-15 08:35:062024-08-15 08:35:07

Judging History

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

  • [2024-08-15 08:35:07]
  • 评测
  • 测评结果:0
  • 用时:13ms
  • 内存:3624kb
  • [2024-08-15 08:35:06]
  • 提交

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);
    for (int j = 0; 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;
    }
    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
*/

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: 3624kb

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

result:

points 1.0 points  1.0 correct 2456 queries

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3620kb

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

result:

wrong answer the graph you report is incorrect