QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#305780#6668. TrokutiHuasushis0 7ms3824kbC++142.6kb2024-01-15 23:46:092024-01-15 23:46:10

Judging History

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

  • [2024-01-15 23:46:10]
  • 评测
  • 测评结果:0
  • 用时:7ms
  • 内存:3824kb
  • [2024-01-15 23:46:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int n = 100;
int a[110][110];
int fc[15];
int tmp[6][6], tot;
int fa[210];
int getfa(int v) {
  return v == fa[v] ? v : fa[v] = getfa(fa[v]);
}
int main() {
  ios::sync_with_stdio(false);
  for (int i = 1; i <= 5; ++i) {
    for (int j = i + 1; j <= 5; ++j) {
      tmp[i][j] = ++tot;
    }
  }
  tot = 0;
  for (int i = 1; i <= 5; ++i) {
    for (int j = i + 1; j <= 5; ++j) {
      for (int k = j + 1; k <= 5; ++k) {
        ++tot;
        cout << "? " << i << ' ' << j << ' ' << k << endl;
        int bs = 0;
        cin >> bs;
        fc[tot] = bs;
      }
    }
  }
  for (int mj = 0; mj < (1 << 10); ++mj) {
    int ls[11];
    for (int j = 1; j <= 10; ++j) ls[j] = (mj >> (j - 1)) & 1;
    tot = 0;
    for (int i = 1; i <= 5; ++i) {
      for (int j = i + 1; j <= 5; ++j) {
        for (int k = j + 1; k <= 5; ++k) {
          ++tot;
          if (ls[tmp[i][j]] + ls[tmp[i][k]] + ls[tmp[j][k]] != fc[tot]) goto nxt;
        }
      }
    }
    for (int i = 1; i <= 5; ++i) {
      for (int j = i + 1; j <= 5; ++j) {
        a[i][j] = ls[tmp[i][j]];
        a[j][i] = a[i][j];
      }
    }
    break;
    nxt:;
  }
  for (int i = 6; i <= n; ++i) {
    const int li = i, yi = i + i;
    static mt19937 mt(19260817 ^ 19491001);
    iota(fa + 1, fa + i * 2 + 1, 1);
    deque<int> p;
    for (int j = 1; j < i; ++j) p.emplace_back(j);
		shuffle(p.begin(), p.end(), mt);
    while (p.size() > 1) {
      int u = p[0], v = p[1];
      p.pop_front(), p.pop_front();
      cout << "? " << i << ' ' << u << ' ' << v << endl;
      int bs = 0;
      cin >> bs;
      bs -= a[u][v];
      switch (bs) {
        case 0: case 2: {
          fa[getfa(u)] = fa[getfa(v)] = getfa(bs ? yi : li);
          fa[getfa(u + i)] = fa[getfa(v + i)] = getfa(bs ? li : yi);
          break;
        }
        case 1: {
          fa[getfa(u)] = getfa(v + i);
          fa[getfa(v)] = getfa(u + i);
          p.emplace_back(u);
          break;
        }
      }
    }
    if (!p.empty()) {
			int u = p[0], v = p[0] == 1 ? 2 : 1;
			cout << "? " << i << ' ' << u << ' ' << v << endl;
			int bs = 0;
			cin >> bs;
			bs -= a[u][v] + (getfa(v) == getfa(yi));
			fa[getfa(u)] = getfa(i * (bs + 1));
			fa[getfa(u + i)] = getfa(i * (2 - bs));
		}
    for (int j = 1; j < i; ++j) {
      a[i][j] = a[j][i] = getfa(j) == getfa(yi);
    }
  }
  cout << "!" << endl;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cout << a[i][j];
    }
    cout << endl;
  }
  return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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

result:

points 1.0 points  1.0 correct 2504 queries

Test #2:

score: 100
Accepted
time: 5ms
memory: 3576kb

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

result:

points 1.0 points  1.0 correct 2504 queries

Test #3:

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

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

result:

points 1.0 points  1.0 correct 2505 queries

Test #5:

score: 100
Accepted
time: 5ms
memory: 3648kb

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

result:

points 1.0 points  1.0 correct 2512 queries

Test #6:

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

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

result:

wrong answer the graph you report is incorrect