QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#160061#7119. Longest Tripyzy115 22ms4212kbC++173.0kb2023-09-02 19:21:532024-04-28 07:55:56

Judging History

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

  • [2024-04-28 07:55:56]
  • 管理员手动重测本题所有提交记录
  • 测评结果:15
  • 用时:22ms
  • 内存:4212kb
  • [2023-09-02 19:21:54]
  • 评测
  • 测评结果:15
  • 用时:37ms
  • 内存:4260kb
  • [2023-09-02 19:21:53]
  • 提交

answer

#include <bits/stdc++.h>

#include "longesttrip.h"

#if defined(LOCAL)
#define DBG_MACRO_NO_WARNING
#include <dbg.hpp>

#include "grader.cpp"
#else
#define dbg(x...) (0)
#endif

using namespace std;

using ll = long long;

// #define int ll
#define rep(i, f, t) for (int i = (f), ed##i = (t); i <= ed##i; ++i)
#define re(i, t) rep (i, 1, t)
#define per(i, t, f) for (int i = (t), ed##i = (f); i >= ed##i; --i)
#define ste(i, f, t, s) for (int i = (f), ed##i = (t); i <= ed##i; i += s)
#define nxt(i, f, g) for (int i = g.h[f]; i; i = g.e[i].n)
#define umod(x) ((x) >= mo && ((x) -= mo))
#define dmod(x) ((x) < 0 && ((x) += mo))
#define y1 y1__
#define fio(x) (freopen(x ".in", "r", stdin), freopen(x ".out", "w", stdout))

template <class T, class E>
__attribute__((always_inline)) inline void up(T &x, E &&y) {
  if (x < y) x = y;
}
template <class T, class E>
__attribute__((always_inline)) inline void down(T &x, E &&y) {
  if (y < x) x = y;
}

namespace qingwa {
const int N = 1009;
mt19937 rnd;
int n, m;
bool flinit;

inline bool Ask(vector<int> x, vector<int> y) {
  for (auto &v : x) --v;
  for (auto &v : y) --v;
  return are_connected(x, y);
}

namespace st2 {
bool vis[N];
int rnk[N];
vector<int> ans;
inline void Dfs1(int f) {
  vis[f] = 1;
  ans.push_back(f);
  if ((int)ans.size() == n) return;
  re (i, n) {
    int t = rnk[i];
    if (vis[t]) continue;
    if (!Ask({f}, {t})) continue;
    Dfs1(t);
    if ((int)ans.size() == n) return;
  }
  vis[f] = 0;
  ans.pop_back();
}
inline vector<int> Work() {
  ans.clear();
  re (i, n) rnk[i] = i;
  while ((int)ans.size() != n) {
    ans.clear();
    re (i, n) vis[i] = 0;
    shuffle(rnk + 1, rnk + n + 1, rnd);
    Dfs1(rnk[1]);
  }
  return ans;
}
}  // namespace st2

namespace st3 {

bool vis[N];
vector<int> Ans, ans;
int tcnt, lim;

inline void Dfs1(int f, vector<int> &rnk) {
  vis[f] = 1;
  ++tcnt;
  ans.push_back(f);
  if (ans.size() > Ans.size()) Ans = ans;
  for (auto t : rnk) {
    if (vis[t]) continue;
    if (!Ask({f}, {t})) continue;
    Dfs1(t, rnk);
    if (tcnt >= lim) return;
  }
  vis[f] = 0;
  ans.pop_back();
}

inline void Foo(vector<int> rnk) {
  shuffle(begin(rnk), end(rnk), rnd);
  tcnt = 0, lim = 2 * n;
  ans.clear();
  Dfs1(rnk[0], rnk);
  for (auto x : rnk) vis[x] = 0;
}

inline vector<int> Work() {
  Ans.clear();
  vector<int> lian[2]{{1}, {}};
  rep (i, 2, n) {
    int id = Ask(lian[0], {i});
    lian[!id].push_back(i);
  }
  // dbg(lian[0], lian[1]);
  Foo(lian[0]);
  if (lian[1].size()) Foo(lian[1]);
  return Ans;
}
}  // namespace st3

inline vector<int> Work() {
  if (m == 3) {
    vector<int> vec;
    re (i, n) vec.push_back(i);
    return vec;
  }
  if (m == 2) return st2::Work();
  return st3::Work();
}
}  // namespace qingwa

std::vector<int> longest_trip(int N, int D) {
  using namespace qingwa;
  if (!flinit) flinit = 1, rnd.seed(random_device()());
  n = N, m = D;
  auto vec = Work();
  for (auto &x : vec) --x;
  return vec;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 3ms
memory: 4076kb

input:

341
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 3
1
3 ...

output:

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

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

103
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10 3
1
10...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 10 0 1 2 3 4 5 6 7 8 9
3kC2Ia2048...

result:

ok 

Test #3:

score: 0
Accepted
time: 1ms
memory: 4072kb

input:

22
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
50 3
1
12 3
1
12 3
1

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 50 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 50 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 3...

result:

ok 

Test #4:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

8
128 3
1
128 3
1
128 3
1
128 3
1
128 3
1
128 3
1
128 3
1
128 3
1

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 128 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 9...

result:

ok 

Test #5:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

4
256 3
1
256 3
1
256 3
1
256 3
1

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
1 256 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 9...

result:

ok 

Subtask #2:

score: 10
Accepted

Test #6:

score: 10
Accepted
time: 0ms
memory: 4116kb

input:

341
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
1
1
3 2
1
...

output:

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

result:

ok 

Test #7:

score: 0
Accepted
time: 3ms
memory: 3812kb

input:

103
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 8 7
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 7 6
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 6 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 0
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 9...

result:

ok 

Test #8:

score: 0
Accepted
time: 0ms
memory: 3880kb

input:

22
50 2
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
50 2
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
50 2
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
1
1
1
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 24 8
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 8 43
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 43 44
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 44 47
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 47 34
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 34 46
3kC2Ia2048BfyJVGojMUKKtilctlZKcB...

result:

ok 

Test #9:

score: 0
Accepted
time: 0ms
memory: 4120kb

input:

8
128 2
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
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
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
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
1
1
1
1
1
1
1
1
128 2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 33 71
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 71 108
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 108 80
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 80 87
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 87 42
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 42 124
3kC2Ia2048BfyJVGojMUKKtilct...

result:

ok 

Test #10:

score: 0
Accepted
time: 0ms
memory: 3848kb

input:

4
256 2
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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 232 118
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 118 133
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 133 83
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 83 101
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 101 110
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 110 9
3kC2Ia2048BfyJVGojMUKK...

result:

ok 

Test #11:

score: 0
Accepted
time: 4ms
memory: 4096kb

input:

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

output:

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

result:

ok 

Test #12:

score: 0
Accepted
time: 5ms
memory: 3816kb

input:

103
10 2
1
1
1
1
0
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
0
1
1
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
0
1
1
1
1
10 2
1
1
0
1
1
1
1
1
1
1
1
10 2
1
1
1
1
1
1
0
1
1
1
1
10 2
1
1
1
1
1
1
1
1
1
1
10 2
1
1
0
1
1
1
1
1
1
1
1
10 2
1
1
1
0
1
1
1
1
1
1
1
10 2
1
1
1
0
1
1
1
1
1
1
1
10 2
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 5 0
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 9
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 9 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 1 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 8
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 8 3...

result:

ok 

Test #13:

score: 0
Accepted
time: 6ms
memory: 3820kb

input:

22
50 2
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
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
50 2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
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
50 2
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
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 13 19
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 19 12
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 12 15
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 15 34
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 34 28
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 28 25
3kC2Ia2048BfyJVGojMUKKtilctlZK...

result:

ok 

Test #14:

score: 0
Accepted
time: 0ms
memory: 4112kb

input:

11
101 2
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
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
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
101 2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 51 63
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 63 33
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 33 58
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 58 85
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 85 77
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 77 100
3kC2Ia2048BfyJVGojMUKKtilctlZ...

result:

ok 

Test #15:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

4
256 2
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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 106 159
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 159 8
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 8 178
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 178 163
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 163 66
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 66 112
3kC2Ia2048BfyJVGojMUKKti...

result:

ok 

Test #16:

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

input:

4
256 2
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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 50 82
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 82 88
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 88 216
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 216 27
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 27 142
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 142 51
3kC2Ia2048BfyJVGojMUKKtilc...

result:

ok 

Test #17:

score: 0
Accepted
time: 3ms
memory: 4144kb

input:

4
256 2
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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 168 216
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 216 170
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 170 252
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 252 8
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 8 27
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 27 88
3kC2Ia2048BfyJVGojMUKKtil...

result:

ok 

Test #18:

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

input:

4
256 2
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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 20 16
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 16 106
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 106 43
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 43 41
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 41 199
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 199 13
3kC2Ia2048BfyJVGojMUKKtilc...

result:

ok 

Subtask #3:

score: 0
Wrong Answer

Test #19:

score: 25
Accepted
time: 0ms
memory: 4072kb

input:

341
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
...

output:

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

result:

ok 

Test #20:

score: 0
Accepted
time: 0ms
memory: 3752kb

input:

103
10 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
10 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
10 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
10 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
10 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #21:

score: 0
Accepted
time: 7ms
memory: 3888kb

input:

22
50 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #22:

score: 0
Accepted
time: 7ms
memory: 3848kb

input:

8
128 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #23:

score: 0
Accepted
time: 7ms
memory: 3924kb

input:

4
256 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #24:

score: 0
Accepted
time: 8ms
memory: 3812kb

input:

341
3 1
1
1
0
1
1
1
3 1
1
1
1
1
0
1
3 1
1
1
1
1
0
1
3 1
1
1
0
1
1
1
3 1
1
1
0
1
1
1
3 1
1
1
1
0
1
0
1
3 1
1
1
1
0
1
0
1
3 1
0
1
1
1
3 1
0
1
1
1
3 1
1
1
1
1
0
1
3 1
0
1
1
1
3 1
1
1
0
1
1
1
3 1
1
1
1
0
1
0
1
3 1
0
1
1
1
3 1
1
1
0
1
1
1
3 1
1
1
1
0
1
0
1
3 1
0
1
1
1
3 1
1
1
1
1
0
1
3 1
0
1
1
1
3 1
1
1
...

output:

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

result:

ok 

Test #25:

score: 0
Accepted
time: 0ms
memory: 4120kb

input:

103
10 1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
1
10 1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
1
1
0
1
1
1
0
1
0
1
10 1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
0
1
1
1
1
1
10 1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
10 1
1
1
1...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 2 3 4 5 6
3kC2Ia2048BfyJVGojMUKK...

result:

ok 

Test #26:

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

input:

22
50 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
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
1
1
1
1
1
1
0
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
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #27:

score: 0
Accepted
time: 6ms
memory: 3840kb

input:

11
101 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
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
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
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
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
0...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #28:

score: 0
Accepted
time: 11ms
memory: 3920kb

input:

4
256 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #29:

score: 0
Accepted
time: 10ms
memory: 4212kb

input:

4
256 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #30:

score: 0
Accepted
time: 14ms
memory: 4212kb

input:

4
256 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #31:

score: 0
Accepted
time: 13ms
memory: 4004kb

input:

4
256 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #32:

score: 0
Accepted
time: 9ms
memory: 4068kb

input:

341
3 1
0
1
1
1
3 1
0
1
1
1
3 1
0
1
1
1
3 1
0
0
1
1
3 1
0
1
1
1
3 1
0
1
1
1
3 1
0
0
1
1
3 1
0
1
1
1
3 1
0
1
1
1
3 1
0
1
1
1
3 1
0
1
1
1
3 1
0
0
1
1
3 1
1
0
1
1
3 1
0
0
1
1
3 1
0
0
1
1
3 1
0
0
1
1
3 1
0
0
1
1
3 1
0
1
1
1
3 1
0
0
1
1
3 1
0
1
1
1
3 1
0
1
1
1
3 1
0
0
1
1
3 1
1
0
1
1
3 1
0
1
1
1
3 1
0
1
...

output:

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

result:

ok 

Test #33:

score: -25
Wrong Answer
time: 2ms
memory: 3876kb

input:

205
5 1
0
1
0
1
1
1
1
1
1
1
5 1
1
0
1
0
1
1
1
1
1
1
5 1
1
1
0
0
1
1
1
1
1
1
5 1
0
0
1
0
1
1
1
1
1
1
5 1
0
0
1
0
1
1
1
1
1
1
5 1
0
0
1
1
1
1
1
1
1
1
5 1
1
0
0
0
1
1
1
1
1
1
5 1
1
0
0
1
1
1
1
1
1
1
5 1
1
0
0
1
1
1
1
1
1
1
5 1
0
0
1
0
1
1
1
1
1
1
5 1
1
0
1
0
1
1
1
1
1
1
5 1
0
0
1
0
1
1
1
1
1
1
5 1
1
1
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 2 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 2 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 4 0
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1...

result:

wrong answer 

Subtask #4:

score: 0
Wrong Answer

Test #83:

score: 60
Accepted
time: 7ms
memory: 3828kb

input:

341
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
1
1
1
1
1
3 1
1
1
...

output:

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

result:

ok 

Test #84:

score: 60
Accepted
time: 0ms
memory: 3796kb

input:

103
10 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
10 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
10 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
10 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
10 1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #85:

score: 60
Accepted
time: 22ms
memory: 3836kb

input:

22
50 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #86:

score: 60
Accepted
time: 6ms
memory: 3860kb

input:

8
128 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

ok 

Test #87:

score: 30
Acceptable Answer
time: 7ms
memory: 4184kb

input:

4
256 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
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
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
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
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
...

output:

3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 1 1 0 1
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 2 1 0 1 2
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 3 1 0 1 2 3
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 4 1 0 1 2 3 4
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 5 1 0 1 2 3 4 5
3kC2Ia2048BfyJVGojMUKKtilctlZKcB
0 6 1 0 1 2 3 4 5 6
3kC2Ia2048Bf...

result:

points 0.50 points  0.50

Test #88:

score: 0
Wrong Answer
time: 1ms
memory: 3852kb

input:

341
3 1
1
1
1
1
0
1
3 1
1
1
0
1
1
1
3 1
1
1
1
1
0
1
3 1
1
1
0
1
1
1
3 1
1
1
1
0
1
0

output:

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

result:

wrong answer