QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#793067 | #4565. Rarest Insects | _8_8_# | 25 | 50ms | 4180kb | C++20 | 2.5kb | 2024-11-29 16:28:09 | 2024-11-29 16:28:10 |
Judging History
answer
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n;
vector<int> p;
set<int> cur;
void add(int i) {
cur.insert(i);
i = p[i];
move_inside(i);
}
void del(int i) {
cur.erase(i);
i = p[i];
move_outside(i);
}
vector<vector<int>> solve(int l, int r) {
if(l == r) {
add(l);
return {{l}};
}
int mid = (l + r) >> 1;
auto L = solve(l, mid);
while(!cur.empty()) {
del(*cur.begin());
}
auto R = solve(mid + 1, r);
vector<vector<int>> ret = R;
for(auto v : L) {
add(v[0]);
if(press_button() == 1) {
ret.push_back(v);
} else {
int it = 0;
for(auto j : R) {
del(j[0]);
if(press_button() == 1) {
for(int f : v) {
ret[it].push_back(f);
}
add(j[0]);
break;
}
it++;
add(j[0]);
}
del(v[0]);
}
}
return ret;
}
int try_solve() {
for(int i = 0; i < n; i++) {
add(i);
}
int x = press_button();
if(x < 60) {
set<int> left;
for(int i = 0; i < n; i++) {
del(i);
}
for(int i = 0; i < n; i++) {
left.insert(i);
}
int st = 0, prev = -1;
while(!left.empty()) {
int col = 0;
vector<int> dd;
for(int j : left) {
// cout << press_button() << "x\n";
add(j);
if(press_button() == 2) {
del(j);
} else {
dd.push_back(j);
col++;
}
}
if(prev !=- 1 && col != prev) {
return st;
}
st++;
for(int j : dd) {
del(j);
left.erase(j);
}
prev = col;
}
return st;
}
return -1;
}
int min_cardinality(int NN) {
n = NN;
int res = (int)1e9;
p.resize(n);
iota(p.begin(), p.end(), 0);
shuffle(p.begin(), p.end(), rng);
int val = try_solve();
if(val != -1) return val;
auto f = solve(0, n - 1);
for(auto j : f) {
res = min(res, (int)j.size());
}
return res;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 3800kb
input:
6 3 1 1 1 2 2 2 1 1 2
output:
8 0 0 8 0 4 8 0 1 8 0 5 8 0 3 8 0 2 8 2 8 1 0 8 1 4 8 1 1 8 1 5 8 1 3 8 1 2 8 0 0 8 2 8 0 4 8 2 8 0 1 8 2 8 0 5 8 2 8 1 5 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 1 0 8 1 4 8 1 1 8 0 5 8 2 8 0 3 8 2 8 0 2 8 2 8 1 2 8 3 1
result:
ok
Test #2:
score: 10
Accepted
time: 0ms
memory: 3812kb
input:
2 2 1 2 1
output:
8 0 1 8 0 0 8 2 8 1 1 8 1 0 8 0 1 8 2 8 0 0 8 2 8 1 0 8 1 1 8 0 0 8 2 8 1 0 8 3 2
result:
ok
Test #3:
score: 10
Accepted
time: 1ms
memory: 4092kb
input:
2 1 1 1
output:
8 0 0 8 0 1 8 2 8 1 0 8 1 1 8 0 0 8 2 8 0 1 8 2 8 1 0 8 1 1 8 3 1
result:
ok
Test #4:
score: 10
Accepted
time: 1ms
memory: 3812kb
input:
3 2 1 1 2 1
output:
8 0 2 8 0 0 8 0 1 8 2 8 1 2 8 1 0 8 1 1 8 0 2 8 2 8 0 0 8 2 8 0 1 8 2 8 1 1 8 1 2 8 1 0 8 0 1 8 2 8 3 1
result:
ok
Test #5:
score: 10
Accepted
time: 1ms
memory: 3844kb
input:
5 3 1 2 1 2 2 1 2 1 1
output:
8 0 3 8 0 0 8 0 1 8 0 4 8 0 2 8 2 8 1 3 8 1 0 8 1 1 8 1 4 8 1 2 8 0 3 8 2 8 0 0 8 2 8 1 0 8 0 1 8 2 8 0 4 8 2 8 1 4 8 0 2 8 2 8 1 2 8 1 3 8 1 1 8 0 0 8 2 8 0 4 8 2 8 1 4 8 0 2 8 2 8 1 0 8 1 2 8 0 4 8 2 8 3 2
result:
ok
Test #6:
score: 10
Accepted
time: 0ms
memory: 3868kb
input:
8 5 1 1 2 2 2 2 1 2 1 2 2 1 2
output:
8 0 6 8 0 3 8 0 2 8 0 5 8 0 1 8 0 0 8 0 7 8 0 4 8 2 8 1 6 8 1 3 8 1 2 8 1 5 8 1 1 8 1 0 8 1 7 8 1 4 8 0 6 8 2 8 0 3 8 2 8 0 2 8 2 8 1 2 8 0 5 8 2 8 1 5 8 0 1 8 2 8 1 1 8 0 0 8 2 8 1 0 8 0 7 8 2 8 0 4 8 2 8 1 4 8 1 6 8 1 3 8 1 7 8 0 2 8 2 8 0 5 8 2 8 1 5 8 0 1 8 2 8 1 1 8 0 0 8 2 8 0 4 8 2 8 1 4 8 3 1
result:
ok
Test #7:
score: 10
Accepted
time: 3ms
memory: 4128kb
input:
199 199 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...
output:
8 0 35 8 0 22 8 0 62 8 0 49 8 0 0 8 0 169 8 0 173 8 0 116 8 0 179 8 0 170 8 0 161 8 0 14 8 0 135 8 0 93 8 0 109 8 0 130 8 0 74 8 0 44 8 0 75 8 0 100 8 0 117 8 0 122 8 0 133 8 0 190 8 0 125 8 0 39 8 0 61 8 0 65 8 0 90 8 0 84 8 0 118 8 0 27 8 0 120 8 0 97 8 0 178 8 0 166 8 0 81 8 0 66 8 0 89 8 0 48 8 ...
result:
ok
Test #8:
score: 10
Accepted
time: 2ms
memory: 3832kb
input:
200 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
8 0 110 8 0 147 8 0 190 8 0 35 8 0 62 8 0 58 8 0 156 8 0 68 8 0 57 8 0 193 8 0 122 8 0 108 8 0 30 8 0 158 8 0 89 8 0 90 8 0 177 8 0 188 8 0 117 8 0 146 8 0 106 8 0 13 8 0 75 8 0 52 8 0 138 8 0 115 8 0 3 8 0 25 8 0 24 8 0 18 8 0 10 8 0 17 8 0 48 8 0 91 8 0 32 8 0 172 8 0 109 8 0 129 8 0 99 8 0 120 8 ...
result:
ok
Test #9:
score: 10
Accepted
time: 0ms
memory: 4104kb
input:
200 15 1 1 1 2 1 1 1 1 2 1 2 1 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 82 8 0 197 8 0 63 8 0 146 8 0 91 8 0 71 8 0 134 8 0 198 8 0 160 8 0 113 8 0 144 8 0 54 8 0 1 8 0 151 8 0 85 8 0 12 8 0 75 8 0 145 8 0 29 8 0 22 8 0 183 8 0 60 8 0 133 8 0 97 8 0 189 8 0 162 8 0 112 8 0 106 8 0 135 8 0 10 8 0 124 8 0 161 8 0 184 8 0 100 8 0 31 8 0 110 8 0 70 8 0 131 8 0 192 8 0 8...
result:
ok
Test #10:
score: 10
Accepted
time: 8ms
memory: 4068kb
input:
198 21 1 1 2 1 1 1 2 1 2 1 1 2 1 1 2 2 2 2 1 1 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 21 8 0 147 8 0 120 8 0 75 8 0 78 8 0 10 8 0 105 8 0 190 8 0 1 8 0 81 8 0 71 8 0 142 8 0 113 8 0 92 8 0 182 8 0 27 8 0 15 8 0 197 8 0 172 8 0 18 8 0 175 8 0 84 8 0 125 8 0 148 8 0 68 8 0 157 8 0 45 8 0 12 8 0 42 8 0 160 8 0 95 8 0 98 8 0 87 8 0 185 8 0 108 8 0 132 8 0 69 8 0 194 8 0 130 8 0 9 8 0...
result:
ok
Test #11:
score: 10
Accepted
time: 3ms
memory: 3860kb
input:
199 198 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...
output:
8 0 89 8 0 65 8 0 182 8 0 125 8 0 76 8 0 178 8 0 17 8 0 177 8 0 78 8 0 115 8 0 45 8 0 123 8 0 187 8 0 121 8 0 120 8 0 53 8 0 97 8 0 69 8 0 135 8 0 26 8 0 142 8 0 195 8 0 20 8 0 160 8 0 154 8 0 150 8 0 94 8 0 74 8 0 25 8 0 112 8 0 50 8 0 114 8 0 192 8 0 170 8 0 197 8 0 141 8 0 149 8 0 96 8 0 102 8 0 ...
result:
ok
Test #12:
score: 10
Accepted
time: 4ms
memory: 3976kb
input:
197 98 2 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 2 2 2 1 1 2 2 2 1 1 1 1 1 1 2 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 2 2 2 1 1 1 1 1 1 2 1 2 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 2 1 1 2 2 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1...
output:
8 0 32 8 0 158 8 0 125 8 0 140 8 0 57 8 0 10 8 0 180 8 0 82 8 0 183 8 0 68 8 0 182 8 0 105 8 0 13 8 0 98 8 0 87 8 0 16 8 0 31 8 0 38 8 0 120 8 0 164 8 0 119 8 0 123 8 0 23 8 0 36 8 0 157 8 0 59 8 0 11 8 0 169 8 0 29 8 0 153 8 0 43 8 0 124 8 0 127 8 0 184 8 0 58 8 0 6 8 0 88 8 0 94 8 0 73 8 0 18 8 0 ...
result:
ok
Test #13:
score: 10
Accepted
time: 3ms
memory: 3960kb
input:
197 49 1 1 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 7 8 0 84 8 0 97 8 0 102 8 0 134 8 0 159 8 0 196 8 0 53 8 0 116 8 0 183 8 0 187 8 0 173 8 0 195 8 0 62 8 0 175 8 0 168 8 0 145 8 0 30 8 0 162 8 0 158 8 0 161 8 0 193 8 0 48 8 0 78 8 0 9 8 0 120 8 0 98 8 0 115 8 0 109 8 0 91 8 0 34 8 0 143 8 0 192 8 0 130 8 0 178 8 0 99 8 0 131 8 0 154 8 0 149 8 0...
result:
ok
Test #14:
score: 10
Accepted
time: 2ms
memory: 3888kb
input:
198 16 1 1 2 1 1 1 1 1 1 2 2 1 2 2 1 2 2 2 2 2 1 2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 50 8 0 22 8 0 81 8 0 137 8 0 184 8 0 71 8 0 183 8 0 124 8 0 38 8 0 106 8 0 179 8 0 165 8 0 147 8 0 170 8 0 42 8 0 138 8 0 126 8 0 97 8 0 99 8 0 51 8 0 15 8 0 169 8 0 73 8 0 197 8 0 149 8 0 154 8 0 54 8 0 60 8 0 182 8 0 158 8 0 102 8 0 150 8 0 143 8 0 57 8 0 23 8 0 14 8 0 2 8 0 100 8 0 8 8 0 136 ...
result:
ok
Test #15:
score: 10
Accepted
time: 8ms
memory: 4072kb
input:
200 45 1 2 1 1 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 25 8 0 92 8 0 15 8 0 96 8 0 55 8 0 168 8 0 21 8 0 170 8 0 144 8 0 100 8 0 163 8 0 23 8 0 180 8 0 160 8 0 13 8 0 66 8 0 40 8 0 17 8 0 137 8 0 127 8 0 158 8 0 138 8 0 33 8 0 109 8 0 120 8 0 166 8 0 26 8 0 98 8 0 52 8 0 44 8 0 20 8 0 64 8 0 68 8 0 38 8 0 184 8 0 19 8 0 126 8 0 129 8 0 41 8 0 143 8 ...
result:
ok
Test #16:
score: 10
Accepted
time: 13ms
memory: 3884kb
input:
196 32 1 1 1 2 1 2 1 1 2 2 1 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 51 8 0 98 8 0 66 8 0 87 8 0 41 8 0 110 8 0 141 8 0 58 8 0 52 8 0 135 8 0 191 8 0 8 8 0 169 8 0 187 8 0 62 8 0 11 8 0 163 8 0 128 8 0 26 8 0 24 8 0 6 8 0 146 8 0 172 8 0 100 8 0 164 8 0 170 8 0 55 8 0 31 8 0 0 8 0 53 8 0 16 8 0 188 8 0 156 8 0 195 8 0 48 8 0 173 8 0 79 8 0 131 8 0 185 8 0 37 8 0 ...
result:
ok
Test #17:
score: 10
Accepted
time: 8ms
memory: 3876kb
input:
199 34 1 1 2 1 2 1 1 2 1 2 2 2 1 1 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 141 8 0 75 8 0 145 8 0 150 8 0 57 8 0 64 8 0 20 8 0 72 8 0 71 8 0 158 8 0 24 8 0 104 8 0 10 8 0 47 8 0 146 8 0 166 8 0 144 8 0 40 8 0 46 8 0 197 8 0 59 8 0 187 8 0 58 8 0 186 8 0 193 8 0 3 8 0 125 8 0 170 8 0 76 8 0 117 8 0 7 8 0 11 8 0 4 8 0 155 8 0 129 8 0 39 8 0 1 8 0 27 8 0 126 8 0 49 8 0 31...
result:
ok
Test #18:
score: 10
Accepted
time: 9ms
memory: 4116kb
input:
196 20 1 1 1 1 1 2 1 2 2 2 2 2 1 1 2 1 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 85 8 0 16 8 0 194 8 0 165 8 0 169 8 0 109 8 0 132 8 0 98 8 0 143 8 0 24 8 0 30 8 0 129 8 0 161 8 0 99 8 0 126 8 0 34 8 0 139 8 0 64 8 0 174 8 0 57 8 0 131 8 0 107 8 0 74 8 0 147 8 0 60 8 0 121 8 0 186 8 0 95 8 0 15 8 0 175 8 0 5 8 0 69 8 0 23 8 0 43 8 0 144 8 0 82 8 0 146 8 0 61 8 0 76 8 0 158 8...
result:
ok
Test #19:
score: 10
Accepted
time: 0ms
memory: 3804kb
input:
196 25 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 140 8 0 179 8 0 51 8 0 87 8 0 176 8 0 65 8 0 46 8 0 113 8 0 186 8 0 44 8 0 41 8 0 85 8 0 169 8 0 32 8 0 190 8 0 37 8 0 22 8 0 192 8 0 58 8 0 108 8 0 194 8 0 49 8 0 79 8 0 177 8 0 163 8 0 175 8 0 121 8 0 102 8 0 115 8 0 2 8 0 162 8 0 127 8 0 93 8 0 50 8 0 191 8 0 160 8 0 0 8 0 23 8 0 31 8 0 26 8 ...
result:
ok
Test #20:
score: 10
Accepted
time: 3ms
memory: 4104kb
input:
196 19 1 1 1 1 1 1 1 2 1 2 2 2 1 2 1 2 2 1 2 1 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 1 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 103 8 0 92 8 0 11 8 0 29 8 0 55 8 0 93 8 0 150 8 0 27 8 0 116 8 0 107 8 0 188 8 0 118 8 0 174 8 0 148 8 0 101 8 0 185 8 0 65 8 0 114 8 0 69 8 0 34 8 0 140 8 0 72 8 0 191 8 0 39 8 0 180 8 0 7 8 0 15 8 0 1 8 0 124 8 0 24 8 0 74 8 0 117 8 0 130 8 0 6 8 0 125 8 0 122 8 0 172 8 0 82 8 0 141 8 0 21 8 ...
result:
ok
Test #21:
score: 10
Accepted
time: 2ms
memory: 3884kb
input:
200 10 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 2 2 2 2 2 2 2 2 2 1 2 2 1 2 1 2 1 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 1 2 1 2 2 2 2 1 2 2 2 2 2 2 2 1 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2...
output:
8 0 8 8 0 156 8 0 96 8 0 74 8 0 162 8 0 98 8 0 52 8 0 53 8 0 86 8 0 127 8 0 27 8 0 117 8 0 88 8 0 136 8 0 57 8 0 163 8 0 166 8 0 148 8 0 112 8 0 177 8 0 63 8 0 39 8 0 129 8 0 82 8 0 174 8 0 188 8 0 181 8 0 33 8 0 17 8 0 23 8 0 161 8 0 92 8 0 133 8 0 18 8 0 47 8 0 160 8 0 108 8 0 105 8 0 41 8 0 180 8...
result:
ok
Test #22:
score: 10
Accepted
time: 2ms
memory: 3964kb
input:
199 6 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 2 1 1 1 1 1 2 1 1 2 1 1 2 1 2 2 1 1 2 2 2 1 2 1 1 1 1 1 1 1 2 1 2 2 2 2 2 1 2 1 2 2 1 2 1 1 2 2 2 1 1 1 2 2 1 2 2 1 1 2 1 1 1 2 1 2 2 2 2 2 1 2 2 2 1 1 2 2 2 2 2 2 2 1 1 1 2 1 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 ...
output:
8 0 147 8 0 173 8 0 192 8 0 56 8 0 115 8 0 181 8 0 40 8 0 106 8 0 57 8 0 69 8 0 77 8 0 80 8 0 112 8 0 51 8 0 118 8 0 188 8 0 90 8 0 179 8 0 20 8 0 153 8 0 38 8 0 184 8 0 182 8 0 171 8 0 12 8 0 162 8 0 60 8 0 191 8 0 36 8 0 33 8 0 18 8 0 136 8 0 47 8 0 172 8 0 114 8 0 83 8 0 84 8 0 196 8 0 122 8 0 13...
result:
ok
Test #23:
score: 10
Accepted
time: 2ms
memory: 3884kb
input:
198 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 2 1 2 2 2 1 1 1 1 1 2 1 2 1 2 1 1 2 1 2 1 1 1 1 2 2 1 1 2 2 1 1 1 1 1 2 2 1 2 1 1 1 2 2 1 1 2 2 2 2 2 1 2 1 2 2 2 1 2 1 1 2 1 1 1 2 2 1 2 2 1 1 ...
output:
8 0 17 8 0 137 8 0 82 8 0 4 8 0 178 8 0 131 8 0 114 8 0 98 8 0 121 8 0 175 8 0 153 8 0 48 8 0 55 8 0 157 8 0 32 8 0 66 8 0 1 8 0 146 8 0 159 8 0 106 8 0 136 8 0 118 8 0 133 8 0 56 8 0 77 8 0 160 8 0 93 8 0 151 8 0 16 8 0 80 8 0 107 8 0 156 8 0 152 8 0 122 8 0 69 8 0 194 8 0 0 8 0 23 8 0 155 8 0 188 ...
result:
ok
Subtask #2:
score: 15
Accepted
Test #24:
score: 15
Accepted
time: 11ms
memory: 3920kb
input:
1000 1000 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...
output:
8 0 873 8 0 928 8 0 609 8 0 144 8 0 252 8 0 549 8 0 897 8 0 34 8 0 605 8 0 133 8 0 996 8 0 615 8 0 393 8 0 865 8 0 666 8 0 179 8 0 96 8 0 448 8 0 82 8 0 963 8 0 11 8 0 287 8 0 227 8 0 720 8 0 348 8 0 762 8 0 624 8 0 379 8 0 172 8 0 486 8 0 389 8 0 150 8 0 940 8 0 226 8 0 112 8 0 876 8 0 375 8 0 830 ...
result:
ok
Test #25:
score: 15
Accepted
time: 7ms
memory: 3916kb
input:
1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
8 0 448 8 0 297 8 0 340 8 0 875 8 0 770 8 0 831 8 0 959 8 0 151 8 0 927 8 0 60 8 0 510 8 0 670 8 0 118 8 0 23 8 0 132 8 0 999 8 0 784 8 0 950 8 0 972 8 0 816 8 0 439 8 0 3 8 0 72 8 0 721 8 0 861 8 0 84 8 0 415 8 0 556 8 0 375 8 0 737 8 0 349 8 0 759 8 0 793 8 0 675 8 0 454 8 0 895 8 0 445 8 0 968 8 ...
result:
ok
Test #26:
score: 15
Accepted
time: 28ms
memory: 3864kb
input:
999 33 1 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 1 2 1 1 2 1 1 1 2 2 1 2 1 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 1 2 2 1 2 2 1 2 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 837 8 0 142 8 0 83 8 0 298 8 0 742 8 0 473 8 0 923 8 0 434 8 0 614 8 0 160 8 0 566 8 0 831 8 0 266 8 0 164 8 0 262 8 0 436 8 0 901 8 0 585 8 0 845 8 0 739 8 0 178 8 0 703 8 0 622 8 0 832 8 0 80 8 0 686 8 0 637 8 0 140 8 0 821 8 0 435 8 0 120 8 0 38 8 0 208 8 0 582 8 0 468 8 0 834 8 0 138 8 0 400...
result:
ok
Test #27:
score: 15
Accepted
time: 39ms
memory: 3892kb
input:
999 48 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 906 8 0 67 8 0 197 8 0 965 8 0 49 8 0 423 8 0 695 8 0 765 8 0 964 8 0 688 8 0 535 8 0 494 8 0 900 8 0 927 8 0 200 8 0 953 8 0 352 8 0 478 8 0 621 8 0 56 8 0 635 8 0 759 8 0 91 8 0 591 8 0 251 8 0 364 8 0 455 8 0 407 8 0 440 8 0 911 8 0 682 8 0 222 8 0 923 8 0 882 8 0 949 8 0 446 8 0 783 8 0 390 ...
result:
ok
Test #28:
score: 15
Accepted
time: 0ms
memory: 3852kb
input:
996 995 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 ...
output:
8 0 227 8 0 719 8 0 181 8 0 420 8 0 699 8 0 638 8 0 359 8 0 534 8 0 313 8 0 120 8 0 994 8 0 388 8 0 201 8 0 167 8 0 144 8 0 909 8 0 398 8 0 936 8 0 543 8 0 702 8 0 270 8 0 636 8 0 893 8 0 889 8 0 766 8 0 178 8 0 549 8 0 192 8 0 239 8 0 776 8 0 721 8 0 964 8 0 547 8 0 155 8 0 538 8 0 966 8 0 801 8 0 ...
result:
ok
Test #29:
score: 15
Accepted
time: 15ms
memory: 4080kb
input:
995 496 1 2 1 2 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 1 2 2 1 1 1 2 2 1 1 1 1 1 1 2 2 1 2 1 2 1 2 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 2 1 1 2 1 1 2 1 1 1 2 1 1 1 1 1 1 1 2 2 1 1 1 2 2 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 2 2 1 2 2 1 1 1 1 1 ...
output:
8 0 959 8 0 671 8 0 396 8 0 219 8 0 25 8 0 84 8 0 794 8 0 192 8 0 660 8 0 47 8 0 982 8 0 134 8 0 588 8 0 218 8 0 579 8 0 282 8 0 506 8 0 800 8 0 316 8 0 463 8 0 703 8 0 164 8 0 210 8 0 609 8 0 265 8 0 394 8 0 902 8 0 487 8 0 302 8 0 654 8 0 61 8 0 462 8 0 951 8 0 493 8 0 21 8 0 643 8 0 570 8 0 725 8...
result:
ok
Test #30:
score: 15
Accepted
time: 6ms
memory: 3856kb
input:
998 249 2 1 1 1 1 2 1 1 2 1 2 1 1 2 2 1 1 1 1 2 1 2 1 1 1 2 2 2 1 2 2 1 1 2 2 2 1 2 2 2 2 1 2 1 2 1 1 1 2 1 1 2 1 2 1 1 2 2 1 1 1 2 1 1 2 1 1 2 1 2 1 2 2 1 1 1 2 1 2 2 2 1 2 2 2 1 2 2 1 2 2 2 2 1 2 1 1 2 1 1 1 1 1 1 2 2 1 2 1 1 2 2 1 1 1 2 1 1 1 2 1 1 1 2 1 2 2 1 2 2 2 1 2 2 2 1 1 2 2 1 2 1 2 1 1 1 ...
output:
8 0 615 8 0 324 8 0 541 8 0 560 8 0 949 8 0 575 8 0 260 8 0 881 8 0 266 8 0 62 8 0 863 8 0 884 8 0 919 8 0 862 8 0 849 8 0 93 8 0 756 8 0 972 8 0 386 8 0 315 8 0 37 8 0 860 8 0 446 8 0 443 8 0 688 8 0 724 8 0 254 8 0 601 8 0 500 8 0 179 8 0 355 8 0 393 8 0 723 8 0 297 8 0 924 8 0 350 8 0 488 8 0 435...
result:
ok
Test #31:
score: 15
Accepted
time: 0ms
memory: 4044kb
input:
998 34 1 1 1 1 1 1 1 1 2 1 2 1 2 2 2 1 1 1 2 2 2 1 1 2 2 1 1 2 2 1 2 2 2 2 1 2 1 1 2 2 2 1 2 2 1 2 2 1 2 2 2 2 1 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...
output:
8 0 634 8 0 331 8 0 477 8 0 381 8 0 571 8 0 986 8 0 79 8 0 966 8 0 282 8 0 713 8 0 974 8 0 307 8 0 497 8 0 221 8 0 742 8 0 292 8 0 194 8 0 402 8 0 748 8 0 366 8 0 767 8 0 939 8 0 453 8 0 54 8 0 933 8 0 280 8 0 761 8 0 591 8 0 595 8 0 988 8 0 918 8 0 888 8 0 417 8 0 118 8 0 570 8 0 214 8 0 582 8 0 51...
result:
ok
Test #32:
score: 15
Accepted
time: 5ms
memory: 3920kb
input:
1000 217 1 1 2 1 1 1 1 2 1 1 2 1 2 2 2 1 1 1 1 2 1 2 2 1 2 1 2 1 1 2 1 1 2 2 1 2 1 1 2 2 2 1 1 2 1 1 1 1 1 1 1 2 2 1 2 2 2 1 1 1 1 2 2 1 2 1 2 1 1 1 2 2 1 1 2 2 1 2 2 2 1 2 2 2 2 1 2 1 1 2 2 2 1 2 2 2 2 2 1 2 1 2 2 1 1 1 2 1 1 2 1 1 1 2 2 2 1 2 2 1 2 1 1 1 2 1 1 2 1 1 1 2 1 1 2 2 1 2 1 1 2 2 1 2 1 2...
output:
8 0 235 8 0 458 8 0 547 8 0 436 8 0 289 8 0 705 8 0 462 8 0 871 8 0 952 8 0 297 8 0 931 8 0 703 8 0 934 8 0 896 8 0 640 8 0 813 8 0 390 8 0 894 8 0 492 8 0 214 8 0 643 8 0 971 8 0 412 8 0 379 8 0 293 8 0 529 8 0 394 8 0 903 8 0 220 8 0 620 8 0 180 8 0 542 8 0 311 8 0 608 8 0 706 8 0 603 8 0 838 8 0 ...
result:
ok
Test #33:
score: 15
Accepted
time: 16ms
memory: 4116kb
input:
996 141 2 1 1 1 1 1 2 2 1 2 1 1 1 2 2 1 1 1 1 1 1 1 2 2 1 1 1 2 1 2 2 2 1 2 2 1 2 1 2 2 1 1 2 2 2 2 1 1 1 1 1 1 1 1 2 1 2 2 1 1 2 2 2 1 1 1 1 2 2 1 1 1 1 2 1 1 1 1 2 2 2 1 2 2 2 2 2 1 2 2 2 1 2 2 1 2 2 2 2 1 2 1 1 2 2 1 1 2 2 2 2 1 1 1 1 1 2 1 1 1 1 1 2 2 1 1 1 1 2 1 2 1 1 2 1 1 1 1 2 2 1 2 1 2 2 1 ...
output:
8 0 469 8 0 863 8 0 135 8 0 951 8 0 463 8 0 280 8 0 50 8 0 338 8 0 352 8 0 969 8 0 688 8 0 235 8 0 298 8 0 420 8 0 807 8 0 301 8 0 199 8 0 189 8 0 513 8 0 182 8 0 423 8 0 829 8 0 679 8 0 173 8 0 625 8 0 393 8 0 990 8 0 386 8 0 914 8 0 401 8 0 921 8 0 773 8 0 312 8 0 890 8 0 721 8 0 519 8 0 11 8 0 22...
result:
ok
Test #34:
score: 15
Accepted
time: 7ms
memory: 3924kb
input:
1000 125 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 2 1 1 1 2 1 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 1 1 1 1 1 2 1 1 1 1 1 2 2 2 2 1 1 1 2 2 2 2 2 1 1 1 1 1 2 2 1 2 2 2 2 2 2 2 1 2 2 2 1 2 1 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2...
output:
8 0 898 8 0 312 8 0 964 8 0 728 8 0 767 8 0 935 8 0 21 8 0 661 8 0 616 8 0 152 8 0 143 8 0 378 8 0 43 8 0 230 8 0 509 8 0 323 8 0 679 8 0 575 8 0 602 8 0 67 8 0 377 8 0 988 8 0 916 8 0 411 8 0 526 8 0 917 8 0 275 8 0 137 8 0 263 8 0 90 8 0 604 8 0 879 8 0 276 8 0 637 8 0 83 8 0 634 8 0 773 8 0 430 8...
result:
ok
Test #35:
score: 15
Accepted
time: 21ms
memory: 3924kb
input:
1000 93 1 1 1 2 2 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 2 2 2 2 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 2 2 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 2 2 2 2 1 1 2 2 2 2 2 1 2 1 1 2 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 2 2 1 1 2 2 2 2 1 2 1 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 1 1 1 1 2 2 1 ...
output:
8 0 347 8 0 694 8 0 602 8 0 885 8 0 647 8 0 381 8 0 30 8 0 307 8 0 632 8 0 455 8 0 724 8 0 185 8 0 637 8 0 414 8 0 172 8 0 24 8 0 324 8 0 794 8 0 981 8 0 107 8 0 147 8 0 125 8 0 113 8 0 740 8 0 90 8 0 542 8 0 971 8 0 208 8 0 819 8 0 169 8 0 326 8 0 12 8 0 48 8 0 153 8 0 250 8 0 615 8 0 831 8 0 626 8...
result:
ok
Test #36:
score: 15
Accepted
time: 7ms
memory: 4124kb
input:
997 79 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 2 2 1 1 2 2 2 2 2 2 1 2 1 2 2 2 2 1 1 1 2 2 2 1 1 1 1 1 1 1 1 1 2 2 1 1 2 2 1 1 2 1 1 2 1 1 1 1 1 1 1 2 2 1 1 1 1 1 2 2 2 1 1 1 2 2 2 2 2 2 2 1 1 1 2 2 2 2 2 1 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 1 2 1 2 2 1 2 2 2 2 2 2 2 2 2 2 1 1 2 1 1 1 1...
output:
8 0 897 8 0 215 8 0 53 8 0 681 8 0 332 8 0 206 8 0 719 8 0 401 8 0 241 8 0 858 8 0 499 8 0 261 8 0 474 8 0 109 8 0 237 8 0 699 8 0 619 8 0 650 8 0 298 8 0 129 8 0 324 8 0 860 8 0 764 8 0 910 8 0 311 8 0 380 8 0 357 8 0 841 8 0 479 8 0 812 8 0 238 8 0 843 8 0 616 8 0 730 8 0 986 8 0 198 8 0 916 8 0 6...
result:
ok
Test #37:
score: 15
Accepted
time: 19ms
memory: 3888kb
input:
995 65 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 1 2 1 1 1 2 2 1 1 2 1 1 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 2 2 2 2 2 2 2 1 1 1 1 1 2 2 1 1 1 1 2 2 2 2 2 2 1 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1 2 2 2 2 1 1 1 1 1 1 1 1 1 2 1 1...
output:
8 0 846 8 0 118 8 0 101 8 0 942 8 0 35 8 0 553 8 0 972 8 0 300 8 0 158 8 0 217 8 0 17 8 0 267 8 0 851 8 0 247 8 0 53 8 0 364 8 0 829 8 0 121 8 0 735 8 0 964 8 0 133 8 0 937 8 0 67 8 0 626 8 0 50 8 0 690 8 0 636 8 0 486 8 0 435 8 0 192 8 0 160 8 0 251 8 0 461 8 0 413 8 0 243 8 0 321 8 0 706 8 0 813 8...
result:
ok
Test #38:
score: 15
Accepted
time: 7ms
memory: 3848kb
input:
997 28 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 2 2 2 1 2 2 1 1 1 1 1 1 2 2 1 1 1 2 2 2 2 2 1 2 1 1 2 2 2 1 2 2 1 2 2 2 2 1 1 2 2 2 1 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 1 2 2 1 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2...
output:
8 0 98 8 0 966 8 0 776 8 0 118 8 0 541 8 0 460 8 0 109 8 0 386 8 0 281 8 0 383 8 0 317 8 0 187 8 0 231 8 0 343 8 0 750 8 0 139 8 0 442 8 0 912 8 0 2 8 0 630 8 0 20 8 0 42 8 0 292 8 0 708 8 0 168 8 0 908 8 0 642 8 0 594 8 0 823 8 0 172 8 0 537 8 0 485 8 0 811 8 0 707 8 0 555 8 0 701 8 0 190 8 0 570 8...
result:
ok
Test #39:
score: 15
Accepted
time: 6ms
memory: 3924kb
input:
997 19 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 2 1 2 1 1 2 1 1 2 1 1 1 1 1 1 2 2 1 2 2 2 1 1 2 1 2 2 1 1 1 2 2 1 2 1 1 1 2 2 1 1 1 2 2 1 2 1 1 1 2 2 1 1 2 2 1 1 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 2 2 1 1 1 1 2 2 2 1 2 2 1 1 1 2 2 1 1 2 1 2 2 2 1 2 1 2 2 2 2 2 2 2 2 2 1 2 2 1 1...
output:
8 0 372 8 0 908 8 0 33 8 0 517 8 0 533 8 0 211 8 0 114 8 0 621 8 0 335 8 0 369 8 0 264 8 0 510 8 0 348 8 0 313 8 0 182 8 0 736 8 0 769 8 0 870 8 0 840 8 0 943 8 0 580 8 0 829 8 0 156 8 0 439 8 0 9 8 0 332 8 0 768 8 0 737 8 0 347 8 0 265 8 0 805 8 0 292 8 0 3 8 0 217 8 0 393 8 0 420 8 0 67 8 0 47 8 0...
result:
ok
Test #40:
score: 15
Accepted
time: 0ms
memory: 3944kb
input:
996 11 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 2 1 2 1 1 2 1 1 1 2 2 1 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 1 1 1 1 2 2 2 2 1 1 1 1 1 1 1 1 2 1 2 2 1 1 1 2 1 2 1 2 1 1 1 2 2 2 1 2 1 1 1 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 1 1 1 1 2 1 1 2 1 2 2 1 1 2 1 1 2 2 2 1...
output:
8 0 230 8 0 266 8 0 332 8 0 365 8 0 774 8 0 818 8 0 130 8 0 374 8 0 384 8 0 434 8 0 938 8 0 231 8 0 560 8 0 959 8 0 668 8 0 463 8 0 391 8 0 260 8 0 821 8 0 43 8 0 461 8 0 877 8 0 142 8 0 606 8 0 972 8 0 405 8 0 912 8 0 700 8 0 984 8 0 822 8 0 313 8 0 598 8 0 678 8 0 310 8 0 555 8 0 400 8 0 504 8 0 3...
result:
ok
Test #41:
score: 15
Accepted
time: 0ms
memory: 4136kb
input:
995 7 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 1 1 2 2 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 1 1 1 1 2 2 1 1 1 1 1 2 1 2 1 1 2 1 1 2 1 1 1 1 1 ...
output:
8 0 265 8 0 187 8 0 184 8 0 270 8 0 6 8 0 228 8 0 261 8 0 730 8 0 389 8 0 908 8 0 656 8 0 811 8 0 386 8 0 686 8 0 616 8 0 798 8 0 507 8 0 751 8 0 19 8 0 890 8 0 702 8 0 795 8 0 148 8 0 952 8 0 156 8 0 617 8 0 665 8 0 316 8 0 787 8 0 152 8 0 981 8 0 430 8 0 640 8 0 983 8 0 494 8 0 50 8 0 356 8 0 741 ...
result:
ok
Test #42:
score: 15
Accepted
time: 4ms
memory: 4180kb
input:
995 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 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 2 1 1 1 1 1 1 1 1 1 1 2 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 ...
output:
8 0 203 8 0 13 8 0 240 8 0 780 8 0 26 8 0 755 8 0 551 8 0 157 8 0 562 8 0 185 8 0 930 8 0 635 8 0 10 8 0 992 8 0 495 8 0 479 8 0 821 8 0 351 8 0 856 8 0 734 8 0 807 8 0 319 8 0 143 8 0 536 8 0 304 8 0 485 8 0 877 8 0 618 8 0 155 8 0 186 8 0 38 8 0 580 8 0 94 8 0 130 8 0 285 8 0 58 8 0 292 8 0 784 8 ...
result:
ok
Subtask #3:
score: 0
Wrong Answer
Test #43:
score: 75
Accepted
time: 1ms
memory: 3868kb
input:
2 2 1 2 1
output:
8 0 1 8 0 0 8 2 8 1 1 8 1 0 8 0 1 8 2 8 0 0 8 2 8 1 0 8 1 1 8 0 0 8 2 8 1 0 8 3 2
result:
ok
Test #44:
score: 75
Accepted
time: 0ms
memory: 4036kb
input:
2 1 1 1
output:
8 0 1 8 0 0 8 2 8 1 1 8 1 0 8 0 1 8 2 8 0 0 8 2 8 1 1 8 1 0 8 3 1
result:
ok
Test #45:
score: 75
Accepted
time: 0ms
memory: 3796kb
input:
3 2 1 2 1 1
output:
8 0 1 8 0 2 8 0 0 8 2 8 1 1 8 1 2 8 1 0 8 0 1 8 2 8 0 2 8 2 8 1 2 8 0 0 8 2 8 1 1 8 1 0 8 0 2 8 2 8 3 1
result:
ok
Test #46:
score: 75
Accepted
time: 1ms
memory: 3876kb
input:
6 5 1 2 2 2 2 1 1 2 2 2
output:
8 0 3 8 0 0 8 0 5 8 0 4 8 0 1 8 0 2 8 2 8 1 3 8 1 0 8 1 5 8 1 4 8 1 1 8 1 2 8 0 3 8 2 8 0 0 8 2 8 1 0 8 0 5 8 2 8 1 5 8 0 4 8 2 8 1 4 8 0 1 8 2 8 1 1 8 0 2 8 2 8 1 3 8 1 2 8 0 0 8 2 8 0 5 8 2 8 1 5 8 0 4 8 2 8 1 4 8 0 1 8 2 8 1 1 8 3 1
result:
ok
Test #47:
score: 70.33
Acceptable Answer
time: 0ms
memory: 3868kb
input:
10 6 1 2 1 2 2 2 2 2 2 2 1 2 2 1 2 2 2 2 1 2 1 2 2 2 1 1 2 2 1 2
output:
8 0 8 8 0 9 8 0 7 8 0 5 8 0 6 8 0 3 8 0 2 8 0 1 8 0 4 8 0 0 8 2 8 1 8 8 1 9 8 1 7 8 1 5 8 1 6 8 1 3 8 1 2 8 1 1 8 1 4 8 1 0 8 0 8 8 2 8 0 9 8 2 8 1 9 8 0 7 8 2 8 0 5 8 2 8 1 5 8 0 6 8 2 8 1 6 8 0 3 8 2 8 1 3 8 0 2 8 2 8 1 2 8 0 1 8 2 8 1 1 8 0 4 8 2 8 1 4 8 0 0 8 2 8 1 0 8 1 8 8 1 7 8 0 9 8 2 8 0 5 ...
result:
points 0.93773333330 points 0.93773333330
Test #48:
score: 70.34
Acceptable Answer
time: 12ms
memory: 3992kb
input:
2000 2000 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 ...
output:
8 0 1104 8 0 837 8 0 1499 8 0 1172 8 0 219 8 0 514 8 0 348 8 0 1674 8 0 120 8 0 258 8 0 1802 8 0 1950 8 0 149 8 0 698 8 0 1058 8 0 235 8 0 1877 8 0 1200 8 0 553 8 0 1606 8 0 1326 8 0 15 8 0 1329 8 0 349 8 0 1892 8 0 526 8 0 1761 8 0 413 8 0 1122 8 0 860 8 0 263 8 0 273 8 0 591 8 0 400 8 0 340 8 0 78...
result:
points 0.93786666670 points 0.93786666670
Test #49:
score: 75
Accepted
time: 3ms
memory: 4004kb
input:
2000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
8 0 1460 8 0 1230 8 0 1818 8 0 1452 8 0 856 8 0 878 8 0 816 8 0 830 8 0 1697 8 0 1786 8 0 1580 8 0 1636 8 0 1019 8 0 1405 8 0 1098 8 0 889 8 0 1363 8 0 286 8 0 1166 8 0 1961 8 0 400 8 0 638 8 0 1314 8 0 130 8 0 1789 8 0 116 8 0 1473 8 0 1428 8 0 1376 8 0 1813 8 0 1740 8 0 1134 8 0 1484 8 0 535 8 0 1...
result:
ok
Test #50:
score: 0
Wrong Answer
time: 50ms
memory: 3976kb
input:
2000 46 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 2 1 2 1 1 1 2 1 1 1 1 1 2 1 2 2 1 1 2 2 1 2 1 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 1 2 2 1 1 1 2 2 2 2 2 2 2 1 2 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
8 0 1022 8 0 1124 8 0 1670 8 0 1096 8 0 1017 8 0 382 8 0 1612 8 0 47 8 0 24 8 0 1985 8 0 1634 8 0 501 8 0 574 8 0 1729 8 0 338 8 0 790 8 0 422 8 0 1656 8 0 1282 8 0 1967 8 0 1324 8 0 1284 8 0 433 8 0 1666 8 0 1390 8 0 1477 8 0 1141 8 0 1787 8 0 1304 8 0 562 8 0 801 8 0 706 8 0 1799 8 0 196 8 0 823 8...
result:
wrong answer Too many queries.