QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#519878#6668. Trokutibykem0 1ms3612kbC++202.5kb2024-08-15 08:43:112024-08-15 08:43:11

Judging History

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

  • [2024-08-15 08:43:11]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3612kb
  • [2024-08-15 08:43:11]
  • 提交

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 = 8;
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;
}

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

input:

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 2 4
? 6 1 3
? 6 2 5
? 7 4 2
? 7 1 3
? 7 6 5
!
0000000
0000000
0000000
0000000
0000000
0000000
0000000

result:

wrong answer Token parameter [name=ans_i] equals to "0000000", doesn't correspond to pattern "[01]{100,100}"