QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#503631#6668. Trokutiwsyear100 ✓16ms3868kbC++173.3kb2024-08-03 21:22:462024-08-03 21:22:49

Judging History

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

  • [2024-08-03 21:22:49]
  • 评测
  • 测评结果:100
  • 用时:16ms
  • 内存:3868kb
  • [2024-08-03 21:22:46]
  • 提交

answer

// Author: Klay Thompson
// Problem: P10831 [COTS/CETS 2023] 三角形 Trokuti
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P10831
// Memory Limit: 512 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#ifdef dbg
#define D(...) fprintf(stderr, __VA_ARGS__)
#define DD(...) D("[Debug] "#__VA_ARGS__ " = "), \
              debug_helper::debug(__VA_ARGS__), D("\n")
#include "C:\Users\wsyear\Desktop\OI\templates\debug.hpp"
#else
#define D(...) ((void)0)
#define DD(...) ((void)0)
#endif
#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

template<class T> void chkmn(T &x, T y) { if (y < x) x = y; }
template<class T> void chkmx(T &x, T y) { if (y > x) x = y; }

using namespace std;

const int maxn = 110;
mt19937 rnd(random_device{}());

int n = 100, cnt = 0, a[maxn][maxn], b[maxn][maxn], p[maxn];

int ask(int x, int y, int z) {
  cnt++;
  assert(x >= 1 && x <= n && y >= 1 && y <= n && z >= 1 && z <= n);
  assert(x != y && y != z && z != x);
  // return b[x][y] + b[y][z] + b[z][x];
  cout << "? " << x << " " << y << " " << z << endl;
  return cin >> x, x;
}

int main() {
  // rep (i, 1, n) rep (j, i + 1, n) b[i][j] = b[j][i] = (rnd() & 1);
  string res = ""s;
  rep (i, 1, 5) rep (j, i + 1, 5) rep (k, j + 1, 5) res += to_string(ask(i, j, k));
  rep (S, 0, (1 << 10) - 1) {
    int msk = S;
    rep (i, 1, 5) rep (j, i + 1, 5) a[i][j] = a[j][i] = (msk & 1), msk >>= 1;
    string cur = ""s;
    rep (i, 1, 5) rep (j, i + 1, 5) rep (k, j + 1, 5) cur += to_string(a[i][j] + a[j][k] + a[k][i]);
    if (cur == res) break;
  }
  // rep (i, 1, 5) rep (j, 1, 5) assert(a[i][j] == b[i][j]);
  rep (i, 1, n) p[i] = i;
  rep (i, 6, n) {
    shuffle(p + 1, p + i, rnd);
    int pos = 1, lst = 0;
    while (pos < i - 1) {
      int w = ask(p[pos], p[pos + 1], i) - a[p[pos]][p[pos + 1]];
      if (w == 0 || w == 2) {
        int val = w >> 1;
        a[i][p[pos]] = a[i][p[pos + 1]] = a[p[pos]][i] = a[p[pos + 1]][i] = val;
        per (j, pos - 1, lst + 1) val ^= 1, a[i][p[j]] = a[p[j]][i] = val;
        lst = pos + 1, pos += 2;
      } else {
        pos += 1;
      }
    }
    // 交替段 [lst + 1, pos - 1]
    if (lst + 1 <= pos - 1) {
      if (lst == 0) {
        int w = ask(p[1], p[3], i) - a[p[1]][p[3]];
        int val = w >> 1;
        rep (j, 1, pos - 1) a[i][p[j]] = a[p[j]][i] = val, val ^= 1;
      } else {
        int w = ask(p[1], p[lst + 1], i) - a[p[1]][p[lst + 1]] - a[p[1]][i];
        rep (j, lst + 1, pos - 1) a[i][p[j]] = a[p[j]][i] = w, w ^= 1;
      }
    }
    if (pos == i - 1) {
      a[i][p[i - 1]] = a[p[i - 1]][i] = ask(p[1], p[i - 1], i) - a[p[1]][p[i - 1]] - a[p[1]][i];
    }
  }
  // rep (i, 1, n) rep (j, 1, n) if (a[i][j] != b[i][j]) {
    // cout << i << ", " << j << ": expected " << b[i][j] << " but " << a[i][j] << '\n';
  // }
  // cerr << "used " << cnt << " queries.\n";
  cout << "!" << endl;
  rep (i, 1, n) {
    rep (j, 1, n) cout << a[i][j];
    cout << endl;
  }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 100
Accepted

Test #1:

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

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

result:

points 1.0 points  1.0 correct 2504 queries

Test #2:

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

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

result:

points 1.0 points  1.0 correct 2504 queries

Test #3:

score: 100
Accepted
time: 16ms
memory: 3632kb

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

result:

points 1.0 points  1.0 correct 2505 queries

Test #4:

score: 100
Accepted
time: 2ms
memory: 3632kb

input:

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

result:

points 1.0 points  1.0 correct 2512 queries

Test #6:

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

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

result:

points 1.0 points  1.0 correct 2512 queries

Test #7:

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

input:

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

result:

points 1.0 points  1.0 correct 3281 queries

Test #9:

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

input:

2
2
2
3
3
2
1
1
0
2
3
2
0
3
1
2
0
2
0
3
2
2
3
1
2
2
2
1
3
1
0
3
2
2
1
2
1
2
2
3
0
2
2
3
0
0
2
2
2
2
0
3
1
2
2
0
3
3
0
1
0
2
3
3
2
2
0
1
0
0
1
0
1
2
2
2
1
3
2
1
1
3
2
2
0
1
0
3
2
3
0
1
2
3
0
0
0
2
3
3
2
3
1
1
0
3
3
2
0
0
3
0
1
1
0
2
3
0
3
3
1
3
0
2
0
0
0
2
0
1
3
2
3
1
0
1
3
2
2
0
1
1
0
1
3
2
1
1
3
1
...

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

result:

points 1.0 points  1.0 correct 3326 queries

Test #10:

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

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

result:

points 1.0 points  1.0 correct 3336 queries

Test #12:

score: 100
Accepted
time: 9ms
memory: 3564kb

input:

1
1
1
1
2
1
3
2
1
2
3
0
1
1
2
1
2
0
2
2
3
1
1
2
1
2
2
1
1
2
1
1
1
2
2
3
2
1
0
2
0
3
2
0
1
1
2
2
1
0
3
3
2
2
0
0
0
1
1
2
0
0
3
3
0
1
0
1
1
1
3
2
2
3
3
1
2
2
2
1
2
2
1
2
1
1
1
3
0
2
1
1
1
1
1
3
2
1
2
2
1
2
1
2
2
0
3
2
1
1
2
1
1
1
2
1
1
1
2
1
0
2
2
1
1
2
1
2
1
2
1
1
2
1
1
2
2
0
1
0
3
1
3
1
1
0
2
2
2
1
...

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

result:

points 1.0 points  1.0 correct 3354 queries

Test #13:

score: 100
Accepted
time: 14ms
memory: 3568kb

input:

0
1
1
1
2
3
0
1
1
2
2
1
1
2
2
2
1
1
1
0
2
2
2
1
1
2
2
2
2
2
0
3
0
2
1
2
2
0
2
3
1
3
1
1
2
1
2
2
1
1
2
3
3
1
1
1
1
0
2
3
1
2
2
3
2
1
0
2
1
1
2
1
2
1
2
0
1
3
3
0
2
1
1
2
2
1
2
2
2
3
3
2
1
0
1
1
1
3
2
2
0
1
0
1
3
2
1
1
3
2
1
1
2
1
1
1
1
0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

result:

points 1.0 points  1.0 correct 3366 queries

Test #15:

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

input:

3
2
2
3
3
2
2
2
0
2
1
1
2
3
2
1
1
2
1
0
3
1
1
2
1
1
1
0
1
2
2
1
0
2
2
1
1
1
1
0
0
1
2
3
1
1
2
1
2
1
2
1
1
1
1
2
2
1
2
1
2
2
0
1
1
0
2
2
2
1
3
1
3
0
1
0
2
2
2
2
0
1
2
0
3
2
1
0
1
3
3
1
2
1
1
0
0
0
1
0
1
3
0
0
2
2
2
2
0
2
2
1
2
1
1
0
2
0
1
2
1
2
2
2
1
0
0
0
3
1
2
2
3
1
2
2
1
1
2
0
2
3
2
2
1
1
2
3
1
1
...

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

result:

points 1.0 points  1.0 correct 3349 queries

Test #16:

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

input:

2
2
2
2
2
1
2
0
1
1
2
1
2
0
2
1
2
2
1
2
3
1
1
2
1
3
2
3
1
0
2
2
2
1
1
1
2
1
0
2
2
3
2
0
2
2
2
2
2
2
1
0
0
2
2
0
2
2
1
2
1
3
2
0
2
1
1
1
2
1
1
2
2
1
3
2
2
2
1
2
1
1
2
3
2
2
1
3
1
3
2
1
2
0
1
2
1
3
1
2
0
1
1
1
1
1
2
0
1
3
2
2
3
1
3
2
2
1
2
1
1
2
2
2
0
1
3
2
1
1
3
1
2
2
1
0
1
2
2
2
2
3
3
2
2
3
1
3
2
2
...

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

result:

points 1.0 points  1.0 correct 3369 queries

Test #17:

score: 100
Accepted
time: 9ms
memory: 3636kb

input:

0
1
1
2
1
2
1
2
2
3
1
1
3
1
2
2
0
2
1
1
1
0
2
2
3
1
1
1
1
0
1
1
0
3
1
1
1
2
3
2
3
2
1
1
1
2
2
0
3
1
1
1
1
1
2
2
3
1
1
1
2
0
2
2
0
3
0
0
2
1
2
2
1
2
1
0
2
3
2
0
1
3
2
1
2
3
2
1
2
1
2
2
2
1
1
2
2
0
1
2
1
2
0
1
3
2
3
2
2
1
0
2
1
2
3
2
1
2
2
1
2
2
2
1
2
3
1
2
0
1
3
0
1
3
1
2
0
2
3
1
1
3
3
0
2
2
3
2
2
2
...

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

result:

points 1.0 points  1.0 correct 3342 queries

Test #18:

score: 100
Accepted
time: 6ms
memory: 3652kb

input:

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

result:

points 1.0 points  1.0 correct 3400 queries

Test #20:

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

input:

0
1
0
2
0
2
1
0
1
2
1
1
0
1
1
1
2
1
2
2
1
1
1
2
1
2
0
1
1
1
1
2
1
2
1
0
2
1
1
1
0
2
2
2
2
2
1
2
1
3
3
1
3
1
2
1
1
2
3
1
1
2
3
3
1
2
0
2
1
2
2
1
2
0
1
2
1
1
2
0
2
2
1
1
2
3
1
1
3
2
1
2
0
1
3
2
1
2
1
1
2
2
1
1
1
2
1
1
1
2
2
2
2
2
2
1
2
1
1
2
0
1
1
2
1
2
1
2
2
2
1
1
0
1
2
2
1
2
0
0
0
1
2
3
1
2
1
3
0
2
...

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

result:

points 1.0 points  1.0 correct 3360 queries