QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#117124#6668. Trokutihos_lyric79.406452 19ms3948kbC++148.6kb2023-06-30 13:14:422023-06-30 13:14:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 13:14:45]
  • 评测
  • 测评结果:79.406452
  • 用时:19ms
  • 内存:3948kb
  • [2023-06-30 13:14:42]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }


// [0, 2^32)
unsigned xrand() {
  static unsigned x = 314159265, y = 358979323, z = 846264338, w = 327950288;
  unsigned t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8;
}

// [a, b]
int xrand(int a, int b) { return a + xrand() % (b - a + 1); }


constexpr int N = 100;

#ifdef LOCAL
int secret[N][N];
#endif

int Q;
int Ask(int u, int v, int w) {
  assert(0 <= u); assert(u < N);
  assert(0 <= v); assert(v < N);
  assert(0 <= w); assert(w < N);
  assert(u != v); assert(v != w); assert(w != u);
  ++Q;
  int s;
#ifdef LOCAL
  s = secret[u][v] + secret[v][w] + secret[w][u];
#else
  printf("? %d %d %d\n", u + 1, v + 1, w + 1);
  fflush(stdout);
  scanf("%d", &s);
#endif
  return s;
}

int A[N][N];
void Answer() {
#ifdef LOCAL
  for (int u = 0; u < N; ++u) for (int v = 0; v < N; ++v) {
    assert(secret[u][v] == A[u][v]);
  }
  cerr << "Accepted: Q = " << Q << endl;
#else
  puts("!");
  for (int u = 0; u < N; ++u) {
    for (int v = 0; v < N; ++v) {
      printf("%d", A[u][v]);
    }
    puts("");
  }
  fflush(stdout);
#endif
}


map<vector<int>, vector<int>> psss[6];
void small() {
  for (int n = 3; n <= 5; ++n) {
    const int m = n * (n - 1) / 2;
    for (int p = 0; p < 1 << m; ++p) {
      int a[5][5] = {};
      {
        int pos = 0;
        for (int u = 0; u < n; ++u) for (int v = u + 1; v < n; ++v) {
          a[u][v] = a[v][u] = p >> pos & 1;
          ++pos;
        }
      }
      vector<int> fs;
      for (int u = 0; u < n; ++u) for (int v = u + 1; v < n; ++v) for (int w = v + 1; w < n; ++w) {
        fs.push_back(a[u][v] + a[v][w] + a[w][u]);
      }
      psss[n][fs].push_back(p);
    }
#ifdef LOCAL
    for (const auto &kv : psss[n]) if (kv.second.size() >= 2) {
      cerr << kv.first;
      for (const int p : kv.second) {
        cerr << " ";
        for (int i = 0; i < m; ++i) cerr << ((p >> i) & 1);
      }
      cerr << endl;
    }
#endif
    if (n == 4) {
      for (const auto &kv : psss[n]) {
        for (const int p0 : kv.second) for (const int p1 : kv.second) if (p0 != p1) {
          assert(__builtin_popcount(p0 ^ p1) >= 4);
        }
      }
    }
  }
}

void ae(int u, int v, int c) {
  assert(0 <= u); assert(u < N);
  assert(0 <= v); assert(v < N);
  assert(c == 0 || c == 1);
  if (!~A[u][v]) A[u][v] = c;
  if (!~A[v][u]) A[v][u] = c;
  assert(A[u][v] == c);
  assert(A[v][u] == c);
}

void determine(int n, const int us[]) {
  assert(3 <= n); assert(n <= 5);
  vector<int> fs;
  for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j) for (int k = j + 1; k < n; ++k) {
    const int u = us[i], v = us[j], w = us[k];
    int f;
    if (~A[u][v] && ~A[v][w] && ~A[w][u]) {
      f = A[u][v] + A[v][w] + A[w][u];
    } else {
      f = Ask(u, v, w);
    }
    fs.push_back(f);
  }
  auto it = psss[n].find(fs);
  assert(it != psss[n].end());
  {
    int pos = 0;
    for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j) {
      bool ok = true;
      int c = -1;
      for (const int p : it->second) {
        if (!~c) c = p >> pos & 1;
        ok = ok && (c == (p >> pos & 1));
      }
      if (ok) {
        ae(us[i], us[j], c);
      }
      ++pos;
    }
  }
}

int R;
vector<int> U;
int counter;
void rec(int l, int r) {
  if (r - l >= 3) {
    // for (int i = l; i < r; ++i) swap(U[xrand(l, i)], U[i]);
    const int mid = l + (r - l + 0) / 2;
    for (int i = 0; i < mid - l; ++i) for (int j = i + 1; j < mid - l; ++j) {
++counter;
      int u = U[l + i];
      int v = U[l + j];
      int w = U[mid + (i + j) % (r - mid)];
      // swap((xrand() % 2) ? u : v, v);
      // swap((xrand() % 3) ? ((xrand() % 2) ? u : v) : w, w);
      if (!~A[u][v] && !~A[v][w] && !~A[w][v]) {
        const int f = Ask(u, v, w);
        if (f == 0 || f == 3) {
          ae(u, v, f/3);
          ae(v, w, f/3);
          ae(w, u, f/3);
        } else {
          const int fuv = Ask(R, u, v);
          ae(u, v, fuv - A[R][u] - A[R][v]);
          if (f - A[u][v] == 0 || f - A[u][v] == 2) {
            ae(v, w, (f - A[u][v]) / 2);
            ae(w, u, (f - A[u][v]) / 2);
          } else {
            const int fvw = Ask(R, v, w);
            ae(v, w, fvw - A[R][v] - A[R][w]);
            ae(w, u, f - A[u][v] - A[v][w]);
          }
        }
      }
    }
    rec(mid, r);
  }
}

int main() {
#ifdef LOCAL
  for (int u = 0; u < N; ++u) {
    char buf[N + 1];
    scanf("%s", buf);
    for (int v = 0; v < N; ++v) {
      secret[u][v] = buf[v] - '0';
    }
  }
  for (int u = 0; u < N; ++u) {
    assert(secret[u][u] == 0);
  }
  for (int u = 0; u < N; ++u) for (int v = 0; v < N; ++v) {
    assert(secret[u][v] == secret[v][u]);
  }
#endif
  
  small();
  
  for (int u = 0; u < N; ++u) for (int v = 0; v < N; ++v) if (u != v) {
    A[u][v] = -1;
  }
  
  R = xrand() % N;
  for (int u = 0; u < N; ++u) if (R != u) {
    U.push_back(u);
  }
  for (int i = 0; i < N - 1; ++i) swap(U[xrand(0, i)], U[i]);
  for (int h = 0; h < N - 1; ) {
    vector<int> used(N, 0);
    int us[5];
    fill(us, us + 5, -1);
    used[us[0] = R] = 1;
    for (int i = 1; i < 5; ++i) if (h + (i - 1) < N - 1) {
      used[us[i] = U[h + (i - 1)]] = 1;
    }
    for (int i = 1; i < 5; ++i) if (!~us[i]) {
      for (int u = 0; u < N; ++u) if (!used[u]) {
        used[us[i] = u] = 1;
        break;
      }
      assert(~us[i]);
    }
pv(us,us+5);
    // determine(5, us);
    
    int f[5][5][5] = {};
    for (int i = 0; i < 4; ++i) for (int j = i + 1; j < 4; ++j) for (int k = j + 1; k < 4; ++k) {
      f[i][j][k] = Ask(us[i], us[j], us[k]);
    }
    {
      vector<int> fs;
      for (int i = 0; i < 4; ++i) for (int j = i + 1; j < 4; ++j) for (int k = j + 1; k < 4; ++k) {
        fs.push_back(f[i][j][k]);
      }
      auto it = psss[4].find(fs);
      assert(it != psss[4].end());
      int pos = 0;
      for (int i = 0; i < 4; ++i) for (int j = i + 1; j < 4; ++j) {
        bool ok = true;
        int c = -1;
        for (const int p : it->second) {
          if (!~c) c = p >> pos & 1;
          ok = ok && (c == (p >> pos & 1));
        }
        if (ok) {
          ae(us[i], us[j], c);
        }
        ++pos;
      }
      if (~A[R][us[1]] && ~A[R][us[2]] && ~A[R][us[3]]) {
        h += 3;
        continue;
      }
    }
    for (int i = 0; i < 4; ++i) for (int j = i + 1; j < 4; ++j) {
      f[i][j][4] = Ask(us[i], us[j], us[4]);
    }
    {
      vector<int> fs;
      for (int i = 0; i < 5; ++i) for (int j = i + 1; j < 5; ++j) for (int k = j + 1; k < 5; ++k) {
        fs.push_back(f[i][j][k]);
      }
      auto it = psss[5].find(fs);
      assert(it != psss[5].end());
      int pos = 0;
      for (int i = 0; i < 5; ++i) for (int j = i + 1; j < 5; ++j) {
        bool ok = true;
        int c = -1;
        for (const int p : it->second) {
          if (!~c) c = p >> pos & 1;
          ok = ok && (c == (p >> pos & 1));
        }
        if (ok) {
          ae(us[i], us[j], c);
        }
        ++pos;
      }
      if (~A[R][us[1]] && ~A[R][us[2]] && ~A[R][us[3]] && ~A[R][us[4]]) {
        h += 4;
        continue;
      }
    }
    assert(false);
  }
cerr<<"Q = "<<Q<<endl;
  
  rec(0, N - 1);
cerr<<"counter = "<<counter<<endl;
  
  for (int u = 0; u < N; ++u) for (int v = u + 1; v < N; ++v) if (!~A[u][v]) {
    const int res = Ask(R, u, v);
    ae(u, v, res - A[R][u] - A[R][v]);
  }
  
  Answer();
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 79.4065
Acceptable Answer

Test #1:

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

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:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 1.0 points  1.0 correct 1952 queries

Test #2:

score: 100
Accepted
time: 3ms
memory: 3880kb

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:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 1.0 points  1.0 correct 1952 queries

Test #3:

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

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:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 1.0 points  1.0 correct 1954 queries

Test #4:

score: 100
Accepted
time: 3ms
memory: 3880kb

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:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 1.0 points  1.0 correct 1953 queries

Test #5:

score: 100
Accepted
time: 8ms
memory: 3884kb

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:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 1.0 points  1.0 correct 1969 queries

Test #6:

score: 100
Accepted
time: 3ms
memory: 3884kb

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:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 1.0 points  1.0 correct 1969 queries

Test #7:

score: 100
Accepted
time: 18ms
memory: 3912kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 12 8
? 13 95 8
? 13 46 8
? 12 95 8
? 12 46 8
? 95 46 8
? 13 30 93
? 13 30 56
? 13 93 56
? 30 93 56
? 13 72 11
? 13 72 57
? 13 11 57
? 72 11 57
? 13 32 45
? 13 32 43
? 13 45 43
? 32 45 43
? 13 27 71
? 13 27 49
? 13 71 49
? 27 71 49
? 13 100 75
? 13 100...

result:

points 1.0 points  1.0 correct 3269 queries

Test #8:

score: 89.7484
Acceptable Answer
time: 14ms
memory: 3848kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 8 56
? 13 30 56
? 13 93 56
? 8 30 56
? 8 93 56
? 30 93 56
? 13 72 11
? 13 72 57
? 13 11 57
? 72 11 57
? 13 32 45
? 13 32 43
? 13 45 43
? 32 45 43
? 13 27 71
? 13 27 49
? 13 71 49
? 27 71 49
? 13 100 75
? 13 100...

result:

points 0.8974838710 points  0.8974838710 correct 3627 queries

Test #9:

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

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 1.0 points  1.0 correct 3134 queries

Test #10:

score: 79.5871
Acceptable Answer
time: 12ms
memory: 3896kb

input:

2
0
2
2
0
2
2
2
2
2
2
2
2
2
2
0
2
2
0
0
0
0
2
0
2
2
2
2
2
0
0
2
2
2
2
2
2
2
2
2
2
2
0
2
2
2
0
2
2
2
2
2
2
2
0
2
2
2
2
2
2
2
0
2
2
2
2
2
2
0
2
2
2
2
2
0
0
2
2
2
2
2
0
2
0
0
0
0
2
2
2
2
2
0
2
2
2
2
2
2
2
2
2
2
2
0
2
2
2
2
2
2
2
2
2
2
2
0
2
2
2
2
2
2
2
2
2
0
2
2
2
2
2
2
2
0
2
2
2
2
2
2
2
2
2
2
2
0
2
2
...

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 56 57
? 13 72 57
? 13 11 57
? 56 72 57
? 56 11 57
? 72 11 57
? 13 32 45
? 13 32 43
? 13 45 43
? 32 45 43
? 13 27 71
? 13 27 49
? 13 71 49
? 27 71 49
? 13 100 75
? 13 ...

result:

points 0.79587096770 points  0.79587096770 correct 3852 queries

Test #11:

score: 79.8581
Acceptable Answer
time: 0ms
memory: 3880kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 12 8
? 13 95 8
? 13 46 8
? 12 95 8
? 12 46 8
? 95 46 8
? 13 30 93
? 13 30 56
? 13 93 56
? 30 93 56
? 13 72 11
? 13 72 57
? 13 11 57
? 72 11 57
? 13 72 32
? 13 11 32
? 13 57 32
? 72 11 32
? 72 57 32
? 11 57 32
? 13 45 43
? 13 45 27
? 13 43 27
? 45 43 2...

result:

points 0.79858064520 points  0.79858064520 correct 3846 queries

Test #12:

score: 83.6516
Acceptable Answer
time: 2ms
memory: 3948kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 0.8365161290 points  0.8365161290 correct 3762 queries

Test #13:

score: 82.1161
Acceptable Answer
time: 19ms
memory: 3804kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 49 94
? 13 100 94
? 13 75 94
? ...

result:

points 0.82116129030 points  0.82116129030 correct 3796 queries

Test #14:

score: 79.7226
Acceptable Answer
time: 10ms
memory: 3880kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 94 36
? 13 94 50
? 13 36 50
? 9...

result:

points 0.79722580650 points  0.79722580650 correct 3849 queries

Test #15:

score: 79.5871
Acceptable Answer
time: 4ms
memory: 3876kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 56 57
? 13 72 57
? 13 11 57
? 56 72 57
? 56 11 57
? 72 11 57
? 13 32 45
? 13 32 43
? 13 45 43
? 32 45 43
? 13 27 71
? 13 27 49
? 13 71 49
? 27 71 49
? 13 27 100
? 13 ...

result:

points 0.79587096770 points  0.79587096770 correct 3852 queries

Test #16:

score: 81.7097
Acceptable Answer
time: 12ms
memory: 3880kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 56 72
? 13 56 11
? 13 72 11
? 56 72 11
? 13 57 32
? 13 57 45
? 13 32 45
? 57 32 45
? 13 43 27
? 13 43 71
? 13 27 71
? 43 27 71
? 13 49 100
? 13 49 75
? 13 100 75
? 49 100 75
? 13 49 94
? 13 100 94
? 13 75 94
? ...

result:

points 0.81709677420 points  0.81709677420 correct 3805 queries

Test #17:

score: 79.4065
Acceptable Answer
time: 10ms
memory: 3884kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 12 8
? 13 95 8
? 13 46 8
? 12 95 8
? 12 46 8
? 95 46 8
? 13 30 93
? 13 30 56
? 13 93 56
? 30 93 56
? 13 72 11
? 13 72 57
? 13 11 57
? 72 11 57
? 13 32 45
? 13 32 43
? 13 45 43
? 32 45 43
? 13 27 71
? 13 27 49
? 13 71 49
? 27 71 49
? 13 100 75
? 13 100...

result:

points 0.79406451610 points  0.79406451610 correct 3856 queries

Test #18:

score: 80.5355
Acceptable Answer
time: 6ms
memory: 3884kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 12 8
? 13 95 8
? 13 46 8
? 12 95 8
? 12 46 8
? 95 46 8
? 13 30 93
? 13 30 56
? 13 93 56
? 30 93 56
? 13 72 11
? 13 72 57
? 13 11 57
? 72 11 57
? 13 32 45
? 13 32 43
? 13 45 43
? 32 45 43
? 13 27 71
? 13 27 49
? 13 71 49
? 27 71 49
? 13 100 75
? 13 100...

result:

points 0.80535483870 points  0.80535483870 correct 3831 queries

Test #19:

score: 82.6581
Acceptable Answer
time: 4ms
memory: 3880kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 12 8
? 13 95 8
? 13 46 8
? 12 95 8
? 12 46 8
? 95 46 8
? 13 30 93
? 13 30 56
? 13 93 56
? 30 93 56
? 13 72 11
? 13 72 57
? 13 11 57
? 72 11 57
? 13 72 32
? 13 11 32
? 13 57 32
? 72 11 32
? 72 57 32
? 11 57 32
? 13 45 43
? 13 45 27
? 13 43 27
? 45 43 2...

result:

points 0.82658064520 points  0.82658064520 correct 3784 queries

Test #20:

score: 81.8
Acceptable Answer
time: 15ms
memory: 3892kb

input:

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

output:

? 13 12 95
? 13 12 46
? 13 95 46
? 12 95 46
? 13 8 30
? 13 8 93
? 13 30 93
? 8 30 93
? 13 8 56
? 13 30 56
? 13 93 56
? 8 30 56
? 8 93 56
? 30 93 56
? 13 72 11
? 13 72 57
? 13 11 57
? 72 11 57
? 13 72 32
? 13 11 32
? 13 57 32
? 72 11 32
? 72 57 32
? 11 57 32
? 13 45 43
? 13 45 27
? 13 43 27
? 45 43 2...

result:

points 0.8180 points  0.8180 correct 3803 queries