QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#491285 | #8759. 小班课 | Rong7 | AC ✓ | 982ms | 24376kb | C++14 | 5.3kb | 2024-07-25 18:26:36 | 2024-07-25 18:26:37 |
Judging History
answer
// Not afraid to dark.
#include <bits/stdc++.h>
using namespace std;
#define inline __inline__ __attribute__ ((always_inline))
namespace io {
int pos;
inline int read (int &p = pos){
static int v; static char c;
v = 1, c = getchar (), p = 0;
while (! isdigit (c)){
if (c == '-')
v = - 1;
c = getchar ();
}
while (isdigit (c)){
p = (p << 1) + (p << 3) + (c - 48);
c = getchar ();
}
return p *= v;
}
inline void write (int x){
if (x < 0)
putchar ('-'), x = - x;
static int sta[65], top;
top = 0;
do {
sta[++ top] = x % 10;
x /= 10;
} while (x);
while (top)
putchar (sta[top --] + 48);
}
inline char next_char (){
static char c;
c = getchar ();
while (c == '\n' || c == ' ' || c == '\r')
c = getchar ();
return c;
}
inline void putss (const string s){
for (int i = 0;i < (int) s.size ();++ i)
putchar (s[i]);
}
}
const int N = 500;
int n, m;
int restb, b[N + 5], a[N + 5][N + 5];
int B[N + 5], A[N + 5][N + 5];
namespace F {
const int cV = N * 2 + 5, cE = N * N * 6 + 5, inf = 0x3f3f3f3f;
int s, t;
int firs[cV], nex[cE], to[cE], w[cE], tot;
int cur[cE], dep[cE], Ansflow;
bool inque[cE];
queue < int > q;
inline void init (){
tot = 1;
for (int i = 1;i <= t;++ i) firs[i] = 0;
}
inline void Add (int u, int v, int k){
nex[++ tot] = firs[u]; firs[u] = tot; to[tot] = v; w[tot] = k;
nex[++ tot] = firs[v]; firs[v] = tot; to[tot] = u; w[tot] = 0;
}
inline bool Bfs (){
for (int i = 1;i <= t;++ i)
dep[i] = inf, inque[i] = false, cur[i] = firs[i];
while (! q.empty ()) q.pop ();
dep[s] = 0; inque[s] = true; q.push (s);
while (! q.empty ()){
int u = q.front ();
q.pop ();
inque[u] = false;
for (int e = firs[u], v;e;e = nex[e]){
v = to[e];
if (dep[v] > dep[u] + 1 && w[e] != 0){
dep[v] = dep[u] + 1;
if (inque[v] == false){
q.push (v);
inque[v] = true;
}
}
}
}
return dep[t] != inf;
}
int Dfs (int u, int flow){
if (u == t) return flow;
int used = 0, rlow;
for (int &e = cur[u], v;e;e = nex[e]){
v = to[e];
if (w[e] != 0 && dep[v] == dep[u] + 1){
rlow = Dfs (v, min (flow - used, w[e]));
if (rlow != 0){
used += rlow;
w[e] -= rlow;
w[e ^ 1] += rlow;
if (used == flow)
break;
}
}
}
return used;
}
inline int FLOW (){
static int Ansflow; Ansflow = 0;
while (Bfs ())
Ansflow += Dfs (s, inf);
return Ansflow;
}
} using namespace F;
int rep[N + 5], te[N + 5][N + 5], fr[N + 5];
int us[N + 5], fi[N + 5];
bool vis[N + 5], ustag[N + 5];
int res;
vector < int > ans;
inline void PUSHANS (int x){
for (int i = 1;i <= a[x][0];++ i)
if (b[a[x][i]]){ -- b[a[x][i]]; restb -= ! b[a[x][i]]; ++ res; break; }
ans.push_back (x);
vis[x] = true;
}
bool inD[N + 5];
int deg[N + 5];
vector < int > gt[N + 5];
inline void ARKNIGHTS (){
ans.clear (), res = 0;
io::read (n), io::read (m);
restb = 0;
for (int i = 1;i <= m;++ i) restb += (bool) io::read (b[i]);
for (int i = 1;i <= n;++ i){
vis[i] = false;
io::read (a[i][0]);
for (int j = 1;j <= a[i][0];++ j) io::read (a[i][j]);
}
for (int i = 1;i <= m;++ i)
B[i] = b[i];
for (int i = 1;i <= n;++ i)
for (int j = 0;j <= n;++ j)
A[i][j] = a[i][j];
queue < int > Q;
// int x = 0, f;
while (restb && (int) ans.size () < n){
int L = n - (int) ans.size (), R = restb;
s = L + R + 1, t = s + 1;
init ();
for (int i = 1, cnt = 0;i <= m;++ i)
if (! b[i]) rep[i] = 0;
else rep[i] = ++ cnt, Add (rep[i] + L, t, b[i]);
for (int i = 1, cnt = 0;i <= n;++ i)
if (! vis[i]){
fr[i] = tot + 1;
Add (s, ++ cnt, 1), fi[i] = 0;
for (int j = a[i][0];j >= 1;-- j)
if (rep[a[i][j]]){
te[i][j] = tot + 1, fi[i] = a[i][j];
Add (cnt, rep[a[i][j]] + L, 1);
}
} else
fi[i] = 0;
// f = FLOW ();
// printf (">>%d\n", f);
// if (! x) x = f;
// if (f == 0)
// break;
if (FLOW () == 0)
break;
// printf ("<%d %d %d>\n", L, R, FLOW ());
for (int i = 1;i <= m;++ i) ustag[i] = inD[i] = false, deg[i] = 0, gt[i].clear ();
for (int i = 1;i <= n;++ i)
if (! vis[i] && ! w[fr[i]]){
for (int j = 1;j <= a[i][0];++ j)
if (rep[a[i][j]] && ! w[te[i][j]]){ ustag[us[i] = a[i][j]] = true; break; }
} else us[i] = 0;
for (int i = 1;i <= n;++ i)
if (fi[i] && (! ustag[fi[i]] || fi[i] == us[i])){
// printf ("%d %d\n", i, fi[i], us[i]);
PUSHANS (i);
goto next_case;
}
for (int i = 1;i <= n;++ i)
if (us[i])
gt[us[i]].push_back (fi[i]), ++ deg[fi[i]];
for (int i = 1;i <= m;++ i) if (! deg[i]) Q.push (i);
while (! Q.empty ()){
int u = Q.front (); Q.pop ();
inD[u] = true;
for (int v : gt[u])
if (! (-- deg[v]))
Q.push (v);
}
for (int i = 1;i <= n;++ i)
if (us[i] && ! inD[us[i]]){
PUSHANS (i);
break;
}
next_case : ;
// for (int i = 1;i <= n;++ i)
// if (! vis[i] && ! w[fe[i]])
// PUSHANS (i);
}
for (int i = 1;i <= n;++ i)
if (! vis[i])
PUSHANS (i);
// printf ("%d %d\n", res, x);
io::write (res), putchar ('\n');
for (int i = 0;i < n;++ i)
io::write (ans[i]), putchar (' ');
putchar ('\n');
}
signed main (){
for (int T = io::read ();T --;) ARKNIGHTS ();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 15904kb
input:
3 5 5 1 1 1 1 1 4 1 3 2 4 1 5 4 3 4 2 1 2 3 5 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1 2 0 5 5 0 2 0 0 3 1 5 0 1 1 0 0 5 5 0 1 3 0 1 2 5 4 2 1 5 0 0 3 3 1 4 5 5 1 1 0 2 1 1 2 0 2 4 5 0 1 4 5 5 0 1 1 2 1 2 4 2 0 2 1 3 0 1 1 5 5 0 0 2 2 1 2 4 3 1 4 0 3 5 4 1 3 5 1 2 5 5 1 2 1 0 1 2 1 2 0 3 3 5 2 2 4 3 0 5 5 1 0 1 1 2 0 1 4 1 3 1 3 0 5 5 1 2 1 1 0 1 ...
output:
3 2 3 4 1 5 1 1 2 3 4 5 2 2 5 1 3 4 3 1 3 5 2 4 2 1 3 2 4 5 4 2 5 4 1 3 3 1 4 3 2 5 2 2 4 1 3 5 1 1 2 3 4 5 4 1 2 3 4 5 2 2 3 1 4 5 2 1 4 2 3 5 3 2 3 5 1 4 3 3 4 1 2 5 3 1 2 4 3 5 3 1 3 2 4 5 2 1 3 2 4 5 3 1 4 5 2 3 1 1 2 3 4 5 3 2 3 5 1 4 1 4 1 2 3 5 2 3 4 1 2 5 2 1 4 2 3 5 2...
result:
ok Correct!
Test #6:
score: 0
Accepted
time: 3ms
memory: 16120kb
input:
10 45 47 3 0 2 0 1 1 1 0 2 0 1 0 0 3 0 0 0 4 0 1 0 0 1 2 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 1 2 4 1 2 1 2 3 7 1 37 21 3 13 43 22 0 10 23 46 22 40 12 19 47 27 16 42 4 29 19 45 35 10 6 26 2 43 41 7 9 16 42 44 5 39 40 34 46 14 3 34 3 38 8 10 5 38 23 19 37 9 34 0 5 31 29 15 13 35 3 40 4 28 1 7 6 29 12 9 35 2...
output:
33 1 7 11 6 12 14 17 19 21 25 29 5 30 31 37 10 4 13 16 18 24 35 38 39 8 3 34 40 15 42 43 36 44 2 9 20 22 23 26 27 28 32 33 41 45 39 3 10 12 14 16 17 18 19 7 25 24 28 29 30 31 32 33 20 35 38 11 34 39 6 23 40 21 5 1 41 42 43 36 44 2 15 9 26 45 4 8 13 22 27 37 36 1 3 4 8 10 15 16 17 20 21 18 23 2 25 ...
result:
ok Correct!
Test #7:
score: 0
Accepted
time: 84ms
memory: 18056kb
input:
1 499 497 1 2 0 2 0 1 0 0 0 2 1 2 0 3 1 2 0 0 0 1 0 1 0 2 1 0 1 0 1 1 1 2 0 1 0 1 0 2 2 3 1 1 2 1 0 0 1 0 2 3 0 1 0 0 2 0 1 2 1 0 0 1 2 0 0 2 0 2 0 1 0 1 0 0 1 0 0 1 1 1 1 1 0 0 0 1 2 3 0 0 0 4 2 2 1 2 2 0 1 0 1 0 2 0 1 0 2 0 0 1 1 1 3 2 0 2 2 2 0 1 1 1 1 1 0 1 0 1 1 1 1 1 2 0 0 1 0 2 1 2 1 2 1 0 1 ...
output:
482 2 4 5 9 14 30 31 34 22 41 42 43 48 53 55 58 59 61 63 66 70 74 78 89 91 92 95 101 104 110 112 113 117 120 121 122 123 124 125 126 134 135 137 141 142 87 143 148 153 79 118 156 160 164 167 169 171 65 116 172 174 176 187 188 190 195 197 203 204 205 208 211 216 217 223 225 226 228 230 231 232 234 23...
result:
ok Correct!
Test #8:
score: 0
Accepted
time: 982ms
memory: 24376kb
input:
1 498 499 0 1 1 0 1 0 1 0 0 0 0 2 0 3 1 2 4 0 1 0 1 1 0 0 0 1 1 0 0 2 2 0 1 1 1 0 4 1 1 2 1 0 0 1 2 0 1 2 1 0 1 2 0 2 1 2 2 0 2 2 0 1 0 2 0 0 3 0 1 1 1 1 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 2 1 1 0 1 0 1 0 0 0 1 1 2 0 1 0 2 1 1 2 2 0 0 0 0 2 0 2 1 0 1 0 2 0 1 3 1 1 1 0 1 3 0 1 0 1 0 0 1 3 2 3 2 1 1 0 2 ...
output:
498 35 59 67 74 77 78 79 86 88 90 96 98 108 109 111 113 114 116 117 118 120 129 132 133 143 148 150 157 160 168 170 174 180 181 182 187 193 194 195 196 197 198 199 201 208 209 211 214 216 218 222 226 227 228 172 231 232 233 234 235 239 240 241 245 247 248 250 252 253 256 259 260 263 265 266 268 269 ...
result:
ok Correct!
Test #9:
score: 0
Accepted
time: 0ms
memory: 16300kb
input:
5 99 96 2 0 0 1 1 2 1 0 1 1 1 0 0 0 1 0 1 1 2 1 1 1 1 1 0 1 2 4 0 0 0 2 2 1 1 1 1 1 0 2 0 0 0 1 1 3 0 1 0 0 1 2 1 4 1 2 1 0 1 0 0 2 0 0 0 2 3 2 1 0 1 2 2 0 1 1 0 0 1 0 0 1 2 1 3 1 3 1 3 0 3 0 0 2 2 2 2 14 58 1 55 2 53 69 0 0 1 76 2 23 38 1 41 2 74 54 0 0 2 83 91 0 0 0 1 48 0 0 1 96 2 76 52 1 17 2 51...
output:
48 2 3 6 7 9 12 16 19 20 22 24 26 30 34 23 35 38 39 40 44 45 46 53 57 60 62 65 66 69 71 72 73 74 77 67 78 82 87 88 42 92 93 56 94 95 97 59 99 1 4 5 8 10 11 13 14 15 17 18 21 25 27 28 29 31 32 33 36 37 41 43 47 48 49 50 51 52 54 55 58 61 63 64 68 70 75 76 79 80 81 83 84 85 86 89 90 91 96 98 44 7 8 1...
result:
ok Correct!
Test #10:
score: 0
Accepted
time: 4ms
memory: 18156kb
input:
5 99 97 0 2 4 0 0 2 0 1 1 1 0 1 0 3 0 1 1 1 1 0 0 1 0 0 1 2 0 0 1 3 1 2 0 2 1 1 1 3 3 1 2 1 0 1 0 1 0 2 0 0 0 0 1 2 3 1 1 1 0 1 0 1 0 0 1 2 1 2 1 1 1 2 2 3 1 1 0 0 1 1 0 0 1 1 2 1 2 2 0 1 1 1 2 0 1 3 1 2 56 63 2 52 45 4 26 56 80 10 2 27 19 1 81 2 38 64 1 83 1 8 3 14 81 60 3 63 28 15 5 59 33 80 88 56...
output:
72 1 3 6 7 8 9 12 13 14 16 20 22 23 24 25 11 17 28 29 30 32 33 35 37 39 40 41 44 34 45 46 47 48 49 53 57 58 62 63 64 54 65 66 68 70 71 72 73 55 76 77 78 79 81 18 82 83 27 52 85 42 60 87 90 91 94 95 96 97 59 98 99 2 4 5 10 15 19 21 26 31 36 38 43 50 51 56 61 67 69 74 75 80 84 86 88 89 92 93 67 2 7 8...
result:
ok Correct!
Test #11:
score: 0
Accepted
time: 3ms
memory: 16304kb
input:
5 99 98 4 0 1 1 3 2 0 1 4 0 1 1 2 2 1 2 0 0 1 2 1 2 0 1 1 1 2 0 2 0 0 3 0 2 0 0 1 1 1 0 1 1 1 2 0 1 1 0 1 1 1 0 0 1 0 0 2 1 2 3 3 0 0 0 0 0 1 2 1 1 0 3 0 0 0 1 2 0 0 0 0 1 0 2 2 1 2 1 0 1 0 0 1 1 2 3 3 0 5 72 78 90 7 60 6 69 37 10 41 4 59 10 61 85 79 5 7 58 3 55 1 50 6 59 24 30 26 77 21 2 29 21 10 7...
output:
85 3 4 5 8 11 12 15 20 21 24 27 29 30 31 35 37 38 40 41 42 47 50 51 53 54 55 46 59 62 63 64 67 69 70 71 49 72 73 76 16 6 60 14 77 78 79 33 80 25 34 82 83 10 26 44 84 85 86 87 89 90 93 94 57 1 32 95 96 97 23 75 2 98 28 43 99 66 68 58 65 19 39 74 81 91 7 9 13 17 18 22 36 45 48 52 56 61 88 92 87 2 3 6...
result:
ok Correct!
Test #12:
score: 0
Accepted
time: 10ms
memory: 16228kb
input:
5 97 100 1 1 1 0 0 1 0 1 1 2 0 1 2 0 1 0 2 3 0 1 0 1 0 1 0 0 1 0 1 2 0 3 2 2 1 0 1 1 2 3 3 1 0 2 1 1 1 2 2 2 0 2 0 3 1 2 2 2 0 1 0 1 1 0 2 0 0 0 0 3 1 0 0 1 0 1 1 0 0 1 1 2 1 2 0 0 1 2 0 1 1 0 2 0 0 1 0 0 2 2 48 80 1 66 89 71 73 40 2 50 99 68 91 31 76 25 67 94 37 6 88 86 28 22 43 62 21 16 17 39 70 1...
output:
94 4 5 6 8 9 10 14 16 3 22 23 25 19 26 27 33 34 37 42 43 44 45 47 49 53 48 55 56 57 60 61 62 63 36 50 64 65 58 66 67 69 11 70 71 72 73 75 51 30 76 13 38 54 31 77 78 79 80 81 20 82 40 84 7 21 52 83 85 86 87 88 28 89 24 32 41 90 59 12 29 2 91 17 92 93 94 39 35 96 18 74 1 15 97 46 68 95 94 1 2 9 12 13...
result:
ok Correct!
Test #13:
score: 0
Accepted
time: 3ms
memory: 16096kb
input:
5 96 96 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 72 44 0 0 1 75 0 2 48 35 1 29 1 55 2 75 32 1 95 0 2 87 85 1 69 1 6 2 48 6 1 77 1 67 0 0 1 75 2 59 ...
output:
59 8 12 13 15 6 16 17 20 9 21 23 25 29 31 32 34 35 36 41 45 47 48 27 49 51 55 56 58 60 61 64 65 67 68 70 71 62 1 73 74 75 78 46 59 39 79 80 81 82 44 83 85 86 87 88 89 90 91 96 2 3 4 5 7 10 11 14 18 19 22 24 26 28 30 33 37 38 40 42 43 50 52 53 54 57 63 66 69 72 76 77 84 92 93 94 95 54 4 7 8 14 16 19...
result:
ok Correct!
Test #14:
score: 0
Accepted
time: 10ms
memory: 19140kb
input:
1 499 497 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
287 1 2 3 6 7 8 10 15 21 23 25 26 27 28 29 31 32 34 24 37 39 40 41 43 47 48 53 55 57 58 60 61 67 68 69 75 77 81 82 84 85 87 89 91 92 96 99 106 107 108 111 114 115 116 119 120 122 80 123 125 134 137 140 141 145 146 147 148 150 152 154 156 159 161 162 166 167 169 170 172 174 176 178 185 186 187 191 19...
result:
ok Correct!
Test #15:
score: 0
Accepted
time: 2ms
memory: 16024kb
input:
10 50 49 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 43 0 0 2 25 28 0 0 2 28 14 0 2 8 38 1 1 0 1 6 1 41 0 2 40 47 2 8 34 2 26 41 2 31 28 1 5 0 2 33 45 0 2 14 43 0 2 39 34 1 32 1 6 1 15 1 17 0 0 2 9 6 2 37 1 0 2 13 20 0 2 4 41 2 31 5 0 2 44 14 1...
output:
30 1 4 10 13 15 16 9 17 19 23 25 27 29 32 33 35 37 38 18 40 41 43 44 45 46 47 48 49 21 50 2 3 5 6 7 8 11 12 14 20 22 24 26 28 30 31 34 36 39 42 27 3 5 6 9 10 17 21 24 14 27 29 34 16 35 38 33 39 12 25 40 41 43 44 45 48 49 50 1 2 4 7 8 11 13 15 18 19 20 22 23 26 28 30 31 32 36 37 42 46 47 25 1 2 3 7...
result:
ok Correct!
Test #16:
score: 0
Accepted
time: 0ms
memory: 18224kb
input:
10 50 49 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 32 0 0 2 47 41 1 10 3 33 18 13 1 43 1 49 1 39 0 0 3 16 27 31 0 0 2 30 25 3 23 16 37 3 18 1 46 2 8 9 3 32 33 10 3 24 14 31 3 31 11 2 2 8 36 1 44 1 9 0 2 39 27 1 14 1 6 3 47 12 10 1 14 1 10 0 1...
output:
32 7 8 9 12 15 16 20 22 23 24 26 28 29 4 30 31 33 36 38 39 19 40 42 21 44 45 46 47 6 17 48 49 1 2 3 5 10 11 13 14 18 25 27 32 34 35 37 41 43 50 31 1 5 6 11 16 17 23 4 25 26 27 28 29 31 32 33 21 34 36 2 3 39 40 41 42 38 43 46 47 48 49 7 8 9 10 12 13 14 15 18 19 20 22 24 30 35 37 44 45 50 35 3 6 8 9...
result:
ok Correct!
Test #17:
score: 0
Accepted
time: 16ms
memory: 18908kb
input:
1 495 495 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
344 1 2 4 6 10 18 19 20 23 24 25 28 41 42 45 48 50 51 54 59 68 70 71 74 77 78 79 90 91 44 92 94 95 96 97 102 103 104 109 60 111 113 114 116 120 121 122 123 125 127 129 132 133 136 139 144 145 146 148 153 155 156 158 37 161 162 169 171 173 174 175 178 179 180 181 182 184 187 190 191 38 192 197 198 20...
result:
ok Correct!
Test #18:
score: 0
Accepted
time: 2ms
memory: 15912kb
input:
250 1 2 1 0 2 1 2 2 2 0 2 1 1 1 1 2 2 1 1 2 1 2 2 1 2 1 1 1 0 2 2 0 2 2 1 2 0 2 1 2 1 1 0 2 2 0 2 1 1 2 1 2 2 1 2 0 0 1 2 0 1 2 1 2 1 1 1 1 1 2 1 2 0 1 1 2 2 1 1 2 1 2 1 1 1 1 1 1 1 2 1 2 0 1 1 1 2 0 1 2 1 2 1 2 0 1 0 1 2 0 1 1 1 2 2 1 1 1 1 2 1 2 2 1 2 1 1 1 1 1 2 1 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4 3 3 4 1 2 5 1 5 1 2 3 4 2 4 3 1 2 5 1 4 1 2 3 5 2 1 4 2 3 5 3 4 2 5 1 3 3 4 3 2 1 5 0 1 2 3 4 5 1 2 1 3 4 5 0...
result:
ok Correct!
Test #22:
score: 0
Accepted
time: 0ms
memory: 16324kb
input:
10 49 49 0 0 0 0 0 1 0 1 0 0 1 0 0 1 1 0 0 1 2 0 2 2 1 1 0 0 2 3 1 2 1 1 1 2 2 0 1 0 1 0 2 2 0 0 4 1 3 3 3 5 3 10 12 16 18 5 2 16 36 21 39 9 19 23 5 31 32 12 15 34 40 0 5 5 19 21 24 30 3 6 8 16 6 15 17 26 2 14 7 1 3 2 14 15 3 16 21 23 6 3 4 17 19 21 22 1 7 7 2 11 28 10 13 31 6 0 6 13 33 43 47 14 1 4...
output:
29 11 16 30 34 38 13 40 26 41 32 39 42 47 28 17 18 29 49 22 15 45 2 5 10 3 20 33 36 46 1 4 6 7 8 9 12 14 19 21 23 24 25 27 31 35 37 43 44 48 22 7 9 12 21 22 24 27 23 29 33 28 38 2 25 36 41 42 32 45 46 47 48 1 3 4 5 6 8 10 11 13 14 15 16 17 18 19 20 26 30 31 34 35 37 39 40 43 44 49 28 6 32 19 26 35...
result:
ok Correct!
Test #23:
score: 0
Accepted
time: 68ms
memory: 18556kb
input:
1 498 500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 2 1 0 1 0 0 2 0 1 0 0 1 1 0 0 0 0 0 2 0 0 1 0 1 0 0 0 0 0 2 1 2 0 1 0 0 1 1 0 1 ...
output:
464 10 26 27 33 39 42 45 46 48 57 60 72 56 78 80 91 94 9 69 12 96 14 103 109 120 135 150 154 160 162 179 189 190 40 73 105 68 212 218 223 225 25 227 230 232 234 242 245 266 267 268 271 285 296 55 303 305 279 306 130 240 312 314 97 129 286 316 317 322 323 213 256 325 34 248 280 330 331 197 22 264 332...
result:
ok Correct!
Test #24:
score: 0
Accepted
time: 475ms
memory: 22528kb
input:
1 497 496 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 1 0 2 1 0 0 0 0 0 0 0 1 1 0 1 0 1 2 1 2 0 1 0 0 1 2 0 1 1 1 0 0 0 0 2 1 1 1 0 0 1 ...
output:
496 45 21 39 60 102 108 110 129 149 155 174 194 15 195 198 199 213 231 234 235 256 261 268 274 279 288 298 299 303 304 307 312 313 319 320 322 330 253 331 333 335 336 343 346 358 359 360 362 366 369 246 372 374 379 270 384 388 390 395 396 397 401 287 402 406 187 407 408 286 171 409 411 414 297 302 4...
result:
ok Correct!
Test #25:
score: 0
Accepted
time: 0ms
memory: 16300kb
input:
5 100 100 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 1 2 0 1 0 0 1 1 1 1 0 2 1 0 0 1 2 1 0 1 1 1 1 0 1 1 2 5 1 0 1 2 0 2 0 3 1 1 1 2 3 2 1 1 1 2 4 2 1 4 1 2 1 0 3 3 1 3 0 0 3 1 0 0 0 3 4 2 1 35 0 1 8 1 35 0 0 1 10 2 15 19 2 1 3 2 6 61 0 0 0 0 2 14 20 2 4 80 0 0 0 1 6 0 1 13 1 4 ...
output:
19 7 10 16 27 37 39 43 48 57 59 66 73 76 54 79 83 84 92 98 1 2 3 4 5 6 8 9 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 28 29 30 31 32 33 34 35 36 38 40 41 42 44 45 46 47 49 50 51 52 53 55 56 58 60 61 62 63 64 65 67 68 69 70 71 72 74 75 77 78 80 81 82 85 86 87 88 89 90 91 93 94 95 96 97 99 100 26 3...
result:
ok Correct!
Test #26:
score: 0
Accepted
time: 4ms
memory: 16308kb
input:
5 95 99 0 0 1 0 0 0 0 0 1 1 0 0 0 2 1 0 0 0 1 0 1 0 0 0 1 2 0 0 1 1 2 0 0 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 2 2 0 0 0 1 0 1 1 1 4 3 0 3 1 2 1 0 1 0 1 5 0 1 1 0 3 0 3 1 2 2 4 0 0 0 1 1 1 2 3 1 0 2 4 0 1 1 4 3 0 1 5 3 31 50 70 1 21 5 14 26 31 2 6 5 7 41 19 45 30 3 1 6 40 0 2 16 19 4 5 6 9 25 0 0 5 17 47...
output:
41 5 15 28 30 36 42 43 44 6 45 47 54 57 59 41 61 63 66 69 70 13 75 78 82 83 84 85 73 87 88 35 3 51 65 89 90 92 72 62 79 93 1 2 4 7 8 9 10 11 12 14 16 17 18 19 20 21 22 23 24 25 26 27 29 31 32 33 34 37 38 39 40 46 48 49 50 52 53 55 56 58 60 64 67 68 71 74 76 77 80 81 86 91 94 95 37 1 5 10 30 34 47 4...
result:
ok Correct!
Test #27:
score: 0
Accepted
time: 2ms
memory: 16620kb
input:
5 97 97 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 0 1 1 0 0 1 1 2 0 0 1 2 1 0 0 1 2 2 1 0 2 0 1 0 0 3 0 2 3 0 2 1 1 1 1 0 1 1 2 4 1 0 2 1 0 1 2 1 2 2 2 1 2 5 2 0 1 0 3 1 3 1 0 1 2 0 0 2 4 2 2 1 2 1 3 0 0 5 14 16 33 41 9 7 12 28 16 32 45 46 71 10 15 63 65 17 66 18 81 45 8 68 6 8 35 12 54 21 63 0 0 0 ...
output:
67 2 5 14 16 23 26 38 4 42 43 45 49 57 59 62 63 21 51 65 66 13 70 71 73 75 80 29 82 25 58 60 83 50 86 72 77 92 93 34 67 10 81 94 53 47 24 64 27 69 3 54 20 36 48 19 56 78 91 41 55 84 87 89 95 31 96 97 1 6 7 8 9 11 12 15 17 18 22 28 30 32 33 35 37 39 40 44 46 52 61 68 74 76 79 85 88 90 62 15 20 24 30...
result:
ok Correct!
Test #28:
score: 0
Accepted
time: 11ms
memory: 16180kb
input:
5 95 95 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 1 1 0 0 2 1 0 0 1 1 0 0 1 0 1 0 0 3 0 2 1 1 5 0 0 0 4 3 0 2 1 0 3 2 2 1 2 1 6 1 3 4 2 1 2 2 3 0 2 0 2 1 1 2 2 1 0 2 1 0 0 1 2 3 16 2 9 23 36 52 58 31 65 66 71 72 17 75 24 44 27 28 4 2 32 38 45 21 52 61 94 55 46 79 92 1 11 65 73 95...
output:
89 3 7 9 18 25 30 35 38 41 50 54 1 61 53 68 71 31 67 72 73 23 26 42 69 79 40 83 36 49 80 84 86 21 4 47 88 37 48 60 75 91 29 92 57 70 82 89 93 44 59 85 34 81 10 11 15 43 66 78 87 94 6 39 51 55 63 64 74 95 2 27 46 65 16 32 76 77 14 20 28 45 22 33 17 19 52 13 56 58 5 8 12 24 62 90 89 2 4 5 6 7 14 15 2...
result:
ok Correct!
Test #29:
score: 0
Accepted
time: 5ms
memory: 16512kb
input:
1 498 500 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 2 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 1 1 2 0 0 1 0 0 0 0 0 1 0 0 2 0 1 1 1 0 0 1 0 2 0 0 1 1 0 0 2 0 0 0 0 0 3 1 0 2 0 1 3 0 0 0 ...
output:
108 12 29 42 54 58 60 86 94 99 110 116 125 127 137 144 149 153 159 173 187 192 197 199 231 237 240 247 250 251 255 260 286 288 291 298 307 210 311 315 319 323 327 186 329 330 331 347 348 360 361 365 374 195 382 384 392 394 395 397 160 401 405 407 409 414 372 416 417 423 426 427 429 432 433 437 386 4...
result:
ok Correct!
Test #30:
score: 0
Accepted
time: 36ms
memory: 18524kb
input:
1 500 498 2 0 0 1 1 1 0 0 0 0 1 1 2 2 2 0 1 0 0 0 1 1 1 0 1 1 2 2 2 1 1 0 4 3 1 1 1 1 0 3 0 3 3 1 2 1 0 2 3 2 0 2 0 0 0 1 1 1 0 2 4 1 0 1 1 1 1 3 1 0 0 1 1 2 2 4 1 1 1 0 0 2 2 1 2 1 1 1 0 0 2 0 0 1 0 0 1 1 1 1 0 1 0 0 1 2 1 1 1 2 2 4 2 0 0 0 0 1 1 0 1 4 1 3 0 2 0 3 0 1 1 1 0 4 0 1 1 3 2 0 0 1 0 1 1 ...
output:
258 228 231 244 247 254 258 260 261 262 263 266 269 283 284 290 296 300 304 308 309 318 325 327 332 334 335 336 337 341 342 344 346 348 303 350 353 355 358 361 363 365 367 369 370 362 372 374 376 378 380 381 383 385 388 389 393 394 395 379 396 397 402 312 368 404 294 382 400 407 408 409 410 390 411 ...
result:
ok Correct!
Test #31:
score: 0
Accepted
time: 305ms
memory: 16760kb
input:
1 496 498 0 0 0 0 2 0 0 1 0 1 1 0 2 3 1 1 2 0 3 2 2 0 2 1 2 0 1 1 1 0 1 2 0 0 0 0 5 1 1 0 2 1 0 0 1 0 0 2 0 3 0 0 3 1 0 3 0 1 1 2 1 2 0 2 0 2 1 0 3 0 1 0 1 1 2 0 1 0 0 1 2 1 2 0 1 0 1 1 1 0 3 3 3 2 0 1 2 1 1 3 1 1 0 0 3 0 1 0 0 0 0 1 3 1 0 1 1 2 1 0 1 2 0 2 0 1 1 1 2 2 0 0 1 2 1 1 1 2 1 3 1 1 1 0 0 ...
output:
248 269 271 281 283 298 300 307 309 312 313 315 325 326 329 332 333 334 337 344 345 349 355 356 357 358 362 363 365 368 369 370 371 373 374 382 383 386 387 388 390 395 396 398 402 403 405 367 406 407 409 410 318 411 414 418 293 419 324 420 423 424 425 282 351 413 426 427 428 430 401 431 432 433 435 ...
result:
ok Correct!
Test #32:
score: 0
Accepted
time: 3ms
memory: 18084kb
input:
10 49 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 0 0 1 4 0 1 7 2 8 7 2 9 8 0 1 10 1 12 2 13 12 0 0 1 16 2 16 17 0 1 19 0 1 20 1 21 1 23 2 24 23 2 25 24 1 26 1 27 1 27 1 28 0 2 31 30 1 32 0 1 33 1 34 2 35 36 1 37 2 38 37 1 38 1 40 2 41 4...
output:
35 1 4 6 7 8 10 11 12 15 16 18 20 21 22 23 24 25 27 28 30 31 33 34 35 38 37 39 40 41 43 44 45 46 48 49 2 3 5 9 13 14 17 19 26 29 32 36 42 47 31 1 7 9 11 12 13 14 16 17 18 20 21 23 24 27 28 29 30 32 34 35 36 37 40 39 42 43 45 46 47 49 2 3 4 5 6 8 10 15 19 22 25 26 31 33 38 41 44 48 30 1 2 4 6 8 9 1...
result:
ok Correct!
Test #33:
score: 0
Accepted
time: 0ms
memory: 16320kb
input:
5 99 99 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 0 0 2 5 4 1 5 1 7 0 1 9 1 10 0 2 12 11 1 12 1 14 1 14 2 15 16 1 17 0 1 19 1 19 1 21 2 21 2...
output:
60 1 5 4 6 8 9 12 11 14 15 16 19 21 22 23 25 26 27 33 32 31 34 36 38 40 41 43 44 45 50 51 53 55 56 57 58 60 62 67 66 68 69 70 71 73 75 76 77 81 84 85 87 88 91 93 94 95 96 97 99 2 3 7 10 13 17 18 20 24 28 29 30 35 37 39 42 46 47 48 49 52 54 59 61 63 64 65 72 74 78 79 80 82 83 86 89 90 92 98 63 1 2 3...
result:
ok Correct!
Test #34:
score: 0
Accepted
time: 9ms
memory: 18808kb
input:
1 496 500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
325 1 2 3 6 5 7 9 11 12 13 14 16 18 23 24 26 27 28 29 30 31 32 35 36 38 40 42 43 44 45 47 49 50 53 54 55 57 58 60 62 63 64 65 66 68 69 70 71 73 75 74 76 77 78 82 84 85 88 90 91 92 93 95 97 96 98 99 101 103 102 104 105 107 108 109 112 113 114 115 116 117 118 119 120 121 122 125 124 126 127 129 131 13...
result:
ok Correct!
Test #35:
score: 0
Accepted
time: 0ms
memory: 16128kb
input:
10 46 47 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 3 4 1 5 2 5 6 2 6 5 3 8 6 7 0 1 8 1 10 0 2 11 13 2 14 13 2 14 13 3 15 14 16 2 16 15 1 18 1 18 0 1 20 1 21 1 21 0 2 23 24 1 26 2 27 26 1 27 1 29 1 29 1 31 1 30 1 32 1 32 1 33 2 35 36 2 35 37 1...
output:
34 2 8 9 11 13 12 14 15 17 19 21 23 26 25 28 29 30 32 33 34 35 36 40 39 37 41 42 43 44 45 46 4 5 6 1 3 7 10 16 18 20 22 24 27 31 38 36 2 3 6 5 7 8 9 13 12 10 15 16 14 17 18 21 22 25 27 28 29 31 30 33 34 35 36 37 38 41 42 40 44 45 46 47 1 4 11 19 20 23 24 26 32 39 43 48 39 1 5 8 7 6 9 10 11 12 13 1...
result:
ok Correct!
Test #36:
score: 0
Accepted
time: 5ms
memory: 16404kb
input:
5 99 99 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 3 2 2 4 3 2 4 3 0 2 6 7 1 6 3 8 7 9 2 10 9 1 11 3 12 11 10 3 13 12 11 1 12 2 13 14 0 1 15 ...
output:
75 3 2 6 5 7 9 11 12 10 8 13 15 16 18 20 19 22 23 24 27 30 32 34 41 42 40 39 38 36 44 45 46 47 48 50 54 53 55 56 58 59 60 62 63 64 66 67 68 70 72 73 74 75 77 76 80 82 81 84 83 86 85 87 88 89 90 91 93 92 96 97 95 98 99 1 4 14 17 21 25 26 28 29 31 33 35 37 43 49 51 52 57 61 65 69 71 78 79 94 75 3 2 4...
result:
ok Correct!
Test #37:
score: 0
Accepted
time: 11ms
memory: 16872kb
input:
1 495 497 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
383 2 4 3 6 8 10 9 11 12 13 14 18 20 21 22 23 25 26 30 28 31 34 33 32 36 37 39 42 41 40 43 45 48 51 49 52 53 54 55 59 60 58 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 81 80 79 83 84 82 86 87 89 90 92 91 94 93 95 96 97 98 99 102 103 101 100 106 107 105 108 109 111 110 114 113 115 117 119 1...
result:
ok Correct!
Test #38:
score: 0
Accepted
time: 3ms
memory: 18064kb
input:
10 45 49 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 5 2 0 2 6 5 3 4 5 8 3 9 6 8 3 7 8 10 1 8 3 8 11 10 2 12 10 3 13 12 10 3 14 15 12 3 14 13 12 3 15 17 13 2 15 18 3 19 17 18 4 16 17 19 20 3 18 21 20 1 18 2 19 21 3 21 20 23 3 23 21 25 1 22 3 ...
output:
43 1 3 4 5 6 7 8 10 12 14 11 9 13 15 16 18 19 17 20 21 22 23 27 30 31 33 34 32 35 37 36 40 41 39 38 42 43 44 45 24 25 26 28 2 29 42 1 3 4 2 5 10 12 13 11 7 8 6 16 19 20 21 23 22 18 24 25 27 29 28 26 30 32 33 34 35 36 38 37 39 41 43 44 42 45 14 15 17 9 31 40 44 4 5 3 7 8 6 11 12 19 23 25 21 20 26 2...
result:
ok Correct!
Test #39:
score: 0
Accepted
time: 3ms
memory: 16232kb
input:
5 95 98 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 5 1 3 1 6 3 5 4 7 2 7 8 1 7 3 7 10 6 3 9 11 8 4 10 8 9 11 3 9 10 12 1 12 3 12 14 15 1 16 4 14 ...
output:
90 2 3 6 4 8 9 7 10 12 15 16 17 14 11 13 19 20 21 18 22 23 24 25 26 28 29 30 31 32 33 35 36 34 37 38 40 39 41 43 47 45 42 44 46 50 48 51 49 52 53 54 56 55 58 60 63 61 59 62 64 67 66 65 68 70 71 69 72 74 73 75 77 80 84 81 79 82 83 87 85 89 90 88 86 91 92 93 94 95 1 5 27 57 76 78 90 3 5 2 9 6 10 8 11...
result:
ok Correct!
Test #40:
score: 0
Accepted
time: 41ms
memory: 18240kb
input:
1 498 496 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
462 6 7 8 9 10 12 14 17 13 19 20 16 15 21 22 23 27 25 26 24 28 29 30 32 33 34 35 31 36 37 38 39 41 42 45 44 43 46 47 48 52 49 50 53 56 54 51 57 55 58 64 62 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 79 81 82 83 84 87 90 86 92 93 89 88 91 94 95 96 97 98 99 100 101 102 103 106 104 105 107 108 109 11...
result:
ok Correct!
Test #41:
score: 0
Accepted
time: 0ms
memory: 16336kb
input:
10 49 47 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 3 1 7 4 9 8 10 6 11 2 6 3 4 5 3 3 12 10 5 5 9 6 12 7 5 13 7 10 9 11 3 10 6 12 6 12 16 7 8 10 9 7 11 9 16 12 17 10 15 5 15 14 11 13 9 3 12 18 16 5 13 20 17 15 19 4 15 19 17 12 7 13 15 22 18 19 17 ...
output:
47 3 1 4 8 13 11 17 19 20 18 28 31 34 35 30 29 26 25 21 37 38 40 36 46 47 45 48 49 43 41 33 32 27 24 15 9 16 14 12 10 7 5 23 22 42 44 39 2 6 48 2 3 10 11 12 6 13 15 21 22 18 24 27 23 29 26 20 14 8 4 5 7 1 30 32 34 33 28 37 38 39 40 42 43 36 35 46 47 48 45 41 44 16 17 9 19 25 31 47 3 4 13 19 21 18 ...
result:
ok Correct!
Test #42:
score: 0
Accepted
time: 4ms
memory: 16528kb
input:
5 99 100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 9 7 5 2 9 8 11 7 6 5 8 4 9 3 11 6 9 8 13 10 12 4 6 5 6 12 14 9 11 2 10 14 8 12 15 8 9 14 ...
output:
99 1 2 3 5 8 9 12 13 15 23 30 31 29 21 33 24 20 28 34 37 32 26 22 14 6 18 25 19 17 16 10 11 27 40 41 45 39 36 35 38 42 44 48 52 53 57 56 50 46 51 58 59 60 62 61 55 49 43 47 54 64 68 69 63 65 72 74 75 77 76 70 71 66 67 78 73 83 85 86 87 81 82 90 91 84 79 80 93 89 94 88 96 92 95 97 98 99 4 7 95 11 22...
result:
ok Correct!
Test #43:
score: 0
Accepted
time: 116ms
memory: 18068kb
input:
1 498 499 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
497 1 4 2 5 8 11 6 13 17 14 19 20 21 22 30 32 25 33 34 40 41 18 23 27 24 16 9 31 35 39 38 42 47 48 52 53 56 49 61 62 57 63 65 50 54 59 55 58 64 60 68 72 70 71 73 74 78 75 67 76 69 66 82 83 84 85 81 77 80 79 89 94 86 87 88 91 97 92 96 93 98 99 100 101 106 107 103 95 90 110 113 111 112 104 102 105 108...
result:
ok Correct!