QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#862090 | #2824. 找树 | strcmp | AC ✓ | 2577ms | 214860kb | C++14 | 2.8kb | 2025-01-18 21:48:18 | 2025-01-18 21:48:56 |
Judging History
answer
#include <queue>
#include <vector>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
template <typename T>
void read(T &x) {
x = 0; bool f = 0;
char c = getchar();
for (;!isdigit(c);c=getchar()) if (c=='-') f=1;
for (;isdigit(c);c=getchar()) x=x*10+(c^48);
if (f) x=-x;
}
template<typename F>
inline void write(F x, char ed = '\n')
{
static short st[30];short tp=0;
if(x<0) putchar('-'),x=-x;
do st[++tp]=x%10,x/=10; while(x);
while(tp) putchar('0'|st[tp--]);
putchar(ed);
}
template <typename T>
inline void Mx(T &x, T y) { x < y && (x = y); }
template <typename T>
inline void Mn(T &x, T y) { x > y && (x = y); }
const int N = 75;
const int Ww = 5048;
const int P = 998244353;
const int inv2 = (P + 1) / 2;
ll e[N][N][Ww], w, n, m, W;
char op[N];
void fwt(ll* f, int n, int qwq) {
for (int i = 1, p = 1; i < n; i <<= 1, p++) {
for (int j = 0; j < n; j += i << 1) rep(k, 0, i - 1) {
if (op[p] == '|') f[i + j + k] = (f[i + j + k] + (qwq == 1 ? f[j + k] : P - f[j + k])) % P;
else if (op[p] == '&') f[j + k] = (f[j + k] + (qwq == 1 ? f[i + j + k] : P - f[i + j + k])) % P;
else {
int u = f[j + k], v = f[i + j + k];
f[j + k] = (u + v) % P, f[i + j + k] = (u - v + P) % P;
if (qwq == -1) f[j + k] = (ll)f[j + k] * 499122177 % P, f[i + j + k] = (ll)f[i + j + k] % 499122177 % P;
}
}
}
}
ll M[N][N];
ll fpw(ll x, ll mi) {
ll res = 1;
for (; mi; mi >>= 1, x = x * x % P)
if (mi & 1) res = res * x % P;
return res;
}
ll det() {
ll ans = 1;
rep(i, 1, n - 1) {
rep(j, i + 1, n - 1) {
while (M[i][i]) {
ll w = M[j][i] / M[i][i];
rep(k, i, n - 1) M[j][k] = (M[j][k] - M[i][k] * w % P + P) % P;
swap(M[i], M[j]); ans = P - ans;
}
swap(M[i], M[j]); ans = P - ans;
}
}
rep(i, 1, n - 1) ans = ans * M[i][i] % P;
return ans;
}
ll f[Ww];
int main() {
read(n), read(m), scanf ("%s", op + 1);
w = strlen(op + 1); W = 1 << w;
for (int i = 1, x, y, v;i <= m; i++) {
read(x), read(y), read(v);
e[x][y][v]--, e[y][x][v]--;
e[x][x][v]++, e[y][y][v]++;
}
for (int i = 1;i <= n; i++)
for (int j = 1;j <= n; j++)
fwt(e[i][j], W, 1);
for (int i = 0;i < W; i++) {
for (int j = 1;j <= n; j++)
for (int k = 1;k <= n; k++)
M[j][k] = e[j][k][i];
f[i] = det();
}
fwt(f, W, -1);
for (int i = W - 1;i >= 0; i--)
if (f[i] != 0) return write(i), 0;
return write(-1), 0;
}
详细
Test #1:
score: 100
Accepted
time: 734ms
memory: 210120kb
input:
70 100 &&&&&&&&&&&& 59 1 577 11 18 513 41 11 6 7 33 1 25 26 577 3 57 516 28 5 3 13 56 0 2 32 7 66 53 517 42 31 519 41 34 70 37 54 579 24 15 512 70 32 512 51 49 64 55 19 69 3 31 517 24 8 582 44 45 513 47 58 517 47 41 577 33 22 519 57 41 0 70 50 67 3 6 6 14 43 6 21 1 579 32 27 576 62 7 514 39 36 69 12...
output:
-1
result:
ok single line: '-1'
Test #2:
score: 0
Accepted
time: 740ms
memory: 210376kb
input:
70 100 |&&&&|&&&^&& 70 50 200 51 46 9 48 33 163 14 64 137 53 54 96 32 24 160 7 22 8 40 66 192 12 22 74 20 25 66 7 40 97 27 13 192 3 15 96 43 16 195 23 6 74 7 34 33 5 5 98 12 26 99 44 38 8 27 44 32 10 67 42 19 12 234 6 39 65 27 24 8 58 13 106 37 69 32 4 2 163 33 65 168 3 3 107 56 65 8 42 53 137 32 53...
output:
-1
result:
ok single line: '-1'
Test #3:
score: 0
Accepted
time: 779ms
memory: 212808kb
input:
70 5000 ^&&&&|^&^&&| 70 55 35 32 4 2338 1 45 33 69 4 2337 55 51 2338 26 46 2050 8 5 33 16 51 35 32 10 1 18 67 257 12 37 2307 34 6 2051 30 10 33 21 35 2082 4 27 34 12 4 2337 44 34 2082 11 17 2338 1 2 289 22 2 34 39 68 2304 11 48 289 44 26 2080 57 12 2306 69 15 2338 16 65 2 51 67 2048 1 5 291 64 48 28...
output:
2339
result:
ok single line: '2339'
Test #4:
score: 0
Accepted
time: 1880ms
memory: 212812kb
input:
70 5000 &|^^^^||^&^& 44 16 0 53 69 0 27 35 1 54 69 1 25 16 15 12 58 45 66 33 2504 55 2 25 33 68 56 39 58 2 66 8 39 30 54 65 43 67 6 38 55 531 11 47 974 33 19 706 3 52 6 38 50 756 39 26 408 52 16 1086 26 3 110 65 28 37 63 30 1 18 44 117 30 4 778 38 42 23 65 48 203 70 42 14 24 39 390 30 17 3 64 62 29 ...
output:
3582
result:
ok single line: '3582'
Test #5:
score: 0
Accepted
time: 1954ms
memory: 212812kb
input:
70 5000 |^|&&|&|&&^^ 21 30 91 41 38 827 52 4 429 66 61 101 28 62 416 57 44 124 24 4 572 36 21 175 40 30 2104 18 47 468 22 25 429 3 65 10 22 11 2438 61 22 58 49 43 40 21 6 1573 37 33 340 11 7 1629 50 18 489 55 51 1499 4 2 194 5 45 44 5 59 52 29 12 90 15 40 16 23 2 817 58 34 584 28 69 3269 37 43 255 6...
output:
4071
result:
ok single line: '4071'
Test #6:
score: 0
Accepted
time: 2007ms
memory: 212796kb
input:
70 5000 |&&&&&&&^||^ 27 2 3619 3 18 1697 45 25 2859 64 30 3146 37 10 3409 19 21 3183 61 35 2477 57 62 2807 51 18 3143 54 6 1143 54 67 3318 41 31 3845 45 58 2720 12 17 3023 43 48 2461 66 67 1613 41 3 1283 2 23 1695 38 7 2450 33 44 966 13 64 2730 11 53 1447 58 19 3376 19 27 3559 49 46 1433 70 10 1525 ...
output:
4081
result:
ok single line: '4081'
Test #7:
score: 0
Accepted
time: 1044ms
memory: 212816kb
input:
70 5000 &^&|^|&^&|&& 20 4 42 54 40 9 24 9 27 60 39 2 54 38 10 13 30 33 15 28 112 35 41 1 61 40 2 43 36 2 43 9 1 6 34 2 67 51 72 36 34 8 68 49 314 62 69 0 36 23 1 53 64 91 7 66 0 12 53 322 17 20 10 40 70 74 5 56 0 64 10 57 34 69 97 56 9 361 24 1 16 37 35 17 30 28 19 23 9 8 31 68 122 29 18 0 5 52 1 39...
output:
2106
result:
ok single line: '2106'
Test #8:
score: 0
Accepted
time: 960ms
memory: 212808kb
input:
70 5000 ^^^|&^&&|||^ 15 59 5 42 43 0 6 60 1 47 46 517 22 59 4 14 18 1 22 61 5 66 29 512 29 2 0 28 34 0 64 39 1 62 67 516 61 17 516 2 33 5 51 53 0 66 40 0 9 56 0 1 24 0 34 30 513 5 38 5 9 42 1 29 1 0 55 11 0 63 32 516 12 46 5 9 55 0 26 60 5 13 42 0 3 11 4 8 6 5 59 19 1 29 50 1 10 44 1 37 27 1 2 38 5 ...
output:
517
result:
ok single line: '517'
Test #9:
score: 0
Accepted
time: 2447ms
memory: 212812kb
input:
70 5000 ^^^^|^&^|&^| 24 68 2656 53 20 3694 37 19 651 52 14 2523 34 37 1274 6 45 2965 1 34 742 30 17 3297 27 9 1658 60 43 3045 5 3 826 61 9 2877 6 40 3478 70 53 1014 31 3 3930 33 34 16 70 60 2646 33 1 1910 30 18 1492 61 12 4 1 23 1169 31 63 440 54 4 2717 6 48 2973 44 57 4013 1 12 3821 62 19 1286 5 37...
output:
4095
result:
ok single line: '4095'
Test #10:
score: 0
Accepted
time: 2506ms
memory: 212688kb
input:
70 5000 ^|^^|^|^&|^^ 12 13 128 48 1 2 52 58 66 65 18 256 62 35 130 70 62 2 10 44 384 13 61 0 3 30 128 10 53 2 51 65 2 60 55 0 63 56 66 56 57 2 33 15 0 60 25 0 50 26 0 29 40 2 16 36 2 27 37 386 4 47 194 2 36 0 62 30 450 60 4 2 9 34 0 17 2 450 9 68 2 70 49 2 45 60 130 15 41 0 59 58 0 55 14 322 44 67 6...
output:
450
result:
ok single line: '450'
Test #11:
score: 0
Accepted
time: 2480ms
memory: 212688kb
input:
70 5000 ^|^^|^^^^&|| 20 23 18 44 24 16 10 12 16 49 52 513 57 32 19 51 55 0 46 22 3 53 20 17 58 2 19 14 63 0 30 18 530 35 51 3 12 49 0 62 26 0 1 47 3 8 56 0 59 52 2 1 14 1 28 20 19 29 64 18 5 50 1 61 43 513 65 8 19 61 67 18 49 40 2 59 5 1 18 2 17 60 55 3 25 59 0 63 60 515 57 66 17 7 43 1 22 12 512 54...
output:
2579
result:
ok single line: '2579'
Test #12:
score: 0
Accepted
time: 841ms
memory: 210512kb
input:
70 100 &&&^&^&&&^&| 66 46 9 17 44 26 23 17 4 57 7 5 39 8 17 10 62 330 68 27 6 11 28 10 30 6 1167 48 50 1 59 12 10 62 43 2704 33 5 773 16 49 26 56 52 636 54 58 116 22 65 88 69 62 201 18 24 735 61 30 518 20 69 217 14 67 12 36 34 6 16 24 325 32 33 110 25 13 1289 4 32 56 33 1 71 26 33 2 18 51 1 69 54 40...
output:
-1
result:
ok single line: '-1'
Test #13:
score: 0
Accepted
time: 817ms
memory: 210120kb
input:
70 100 &&&&&^|^&&&& 65 50 57 46 58 417 17 45 155 35 28 56 58 35 823 55 29 2007 11 48 32 61 65 25 1 45 47 3 38 434 50 25 9 9 23 23 59 23 29 30 14 640 4 20 196 21 21 881 66 58 147 49 14 621 4 34 95 26 46 242 45 15 221 31 39 639 40 29 385 43 7 263 49 9 9 36 57 39 45 58 328 39 50 70 47 28 252 6 15 79 32...
output:
-1
result:
ok single line: '-1'
Test #14:
score: 0
Accepted
time: 788ms
memory: 213064kb
input:
70 100 &&|&&&|&&&|& 23 34 2844 56 17 2061 40 69 3004 55 35 2651 55 34 2357 48 56 2876 23 65 1395 50 29 3265 64 49 3467 1 43 4030 8 43 3818 32 43 2461 33 37 442 9 22 2468 65 63 2605 36 60 1149 40 23 1215 19 14 2755 58 42 963 22 41 1776 29 47 372 6 54 886 70 50 1602 25 56 602 66 67 290 50 25 3754 29 1...
output:
-1
result:
ok single line: '-1'
Test #15:
score: 0
Accepted
time: 776ms
memory: 210128kb
input:
70 100 |^&&&|||&&&| 57 54 31 8 6 13 61 30 397 5 42 11 22 50 7 50 6 124 31 36 1 33 52 2 52 49 430 23 21 110 3 68 35 29 63 0 8 55 22 2 64 368 46 12 559 50 32 1 27 36 1 17 23 0 39 67 5 28 61 10 30 32 297 65 44 547 26 61 47 21 21 504 41 1 292 44 27 2 1 33 3628 65 33 1208 17 6 7 14 63 219 59 9 7 9 60 4 2...
output:
-1
result:
ok single line: '-1'
Test #16:
score: 0
Accepted
time: 769ms
memory: 212168kb
input:
70 100 ^&&&&&&&&&&& 42 31 2344 22 49 107 35 21 234 55 47 1367 2 28 2894 11 56 92 34 52 788 54 48 2312 12 8 2642 43 28 306 19 65 2359 35 70 812 61 69 20 55 41 1976 57 25 1544 4 41 8 27 41 103 14 23 234 3 62 79 48 1 453 14 50 38 12 7 3138 24 57 1637 18 70 451 67 66 735 42 34 69 10 63 30 60 38 397 59 5...
output:
-1
result:
ok single line: '-1'
Test #17:
score: 0
Accepted
time: 912ms
memory: 211664kb
input:
70 100 |^&|&^^^^^|| 35 52 8 6 21 131 29 44 2186 68 49 2688 50 55 2698 8 28 2570 24 23 521 60 18 649 36 16 650 46 14 9 7 54 2690 23 65 2562 19 64 643 25 44 2699 34 60 515 24 12 2689 6 45 139 13 8 643 20 20 2178 24 62 2688 38 40 2178 24 47 2699 59 35 520 6 43 521 43 4 2051 38 61 640 29 36 2690 36 55 1...
output:
-1
result:
ok single line: '-1'
Test #18:
score: 0
Accepted
time: 956ms
memory: 209480kb
input:
70 100 |^&|&^^|^^^& 44 6 132 5 65 15 7 15 0 45 8 0 62 65 4 24 39 872 56 36 5 1 51 318 60 18 8 43 37 32 21 44 0 7 21 1324 11 23 179 18 26 1 2 2 2 26 49 326 11 34 357 3 68 2201 50 62 0 63 50 2068 69 64 3985 55 47 43 2 60 55 70 12 0 48 36 6 32 3 9 65 60 9 30 6 115 33 25 822 25 33 14 22 54 131 24 27 716...
output:
-1
result:
ok single line: '-1'
Test #19:
score: 0
Accepted
time: 909ms
memory: 210384kb
input:
70 100 ^^&^^^||^&&^ 60 25 80 3 56 17 5 56 1089 61 34 320 24 38 256 27 14 336 26 65 1025 26 20 16 47 58 64 63 67 16 2 67 16 63 67 17 26 13 1089 33 41 0 31 58 80 50 63 64 43 12 1297 59 59 320 5 44 17 36 68 257 53 30 0 48 1 336 50 50 16 17 66 17 29 17 1025 49 26 257 5 20 0 22 65 0 43 10 1 3 32 64 28 38...
output:
-1
result:
ok single line: '-1'
Test #20:
score: 0
Accepted
time: 877ms
memory: 212808kb
input:
70 300 &&&&&&&&&&&& 35 67 3197 66 41 652 21 4 1282 20 69 3800 25 51 3551 15 8 2464 53 38 2304 10 17 3541 36 55 2796 42 53 2621 54 6 3624 26 11 1719 25 57 3260 43 46 272 49 62 314 30 6 1014 4 45 1644 60 3 330 25 9 325 36 64 4060 12 50 399 30 55 3288 9 32 2876 45 69 3013 16 58 2372 42 56 841 42 65 140...
output:
512
result:
ok single line: '512'
Test #21:
score: 0
Accepted
time: 741ms
memory: 209928kb
input:
70 100 &&&&&&&&&&&& 68 54 104 43 20 52 40 21 52 35 4 4 19 50 2897 43 28 496 16 47 29 25 58 531 18 46 3 19 20 12 25 3 3921 13 4 760 41 37 351 6 4 8 1 46 1117 12 65 346 50 16 91 28 10 45 25 57 39 1 42 39 53 18 1 33 53 1 48 28 63 58 4 0 40 38 290 62 25 3 36 1 1 19 34 48 18 12 28 57 39 809 29 27 324 22 ...
output:
-1
result:
ok single line: '-1'
Test #22:
score: 0
Accepted
time: 806ms
memory: 212756kb
input:
70 300 &&&&&&&&&&&& 46 63 16 52 52 2 32 8 893 17 1 1701 64 67 8 15 53 1 70 39 18 12 11 1 3 56 79 19 54 490 3 33 0 46 42 51 11 34 0 31 33 383 67 20 3 5 45 3 35 36 0 36 63 6 50 42 163 36 13 4077 2 1 2 39 35 3 60 52 409 15 23 11 31 57 948 12 32 41 12 44 211 1 8 18 46 57 11 7 66 282 14 61 16 51 40 273 2...
output:
0
result:
ok single line: '0'
Test #23:
score: 0
Accepted
time: 800ms
memory: 212812kb
input:
70 300 &&&&&&&&&&&& 45 12 93 67 44 27 64 8 112 19 1 135 33 55 84 30 17 62 37 3 31 43 70 20 69 20 223 48 3 3533 33 16 2323 42 56 74 41 39 295 24 28 450 40 4 4076 8 26 4009 53 23 110 29 6 177 28 7 98 59 6 752 33 59 2913 48 55 117 23 54 1882 3 38 312 67 29 121 54 68 73 69 26 48 13 13 213 52 34 305 56 3...
output:
0
result:
ok single line: '0'
Test #24:
score: 0
Accepted
time: 850ms
memory: 212812kb
input:
70 300 |||||||||||| 22 31 669 8 60 317 36 59 1276 60 30 3964 24 64 463 44 61 260 2 5 1115 20 66 1795 41 36 1680 28 14 1803 19 52 2014 29 42 2276 52 70 1719 55 47 1775 6 37 3912 38 15 41 14 2 2223 23 30 1570 70 44 1748 64 43 2908 50 50 3336 36 41 3082 40 3 826 28 39 3609 1 58 677 25 70 643 65 56 1340...
output:
4095
result:
ok single line: '4095'
Test #25:
score: 0
Accepted
time: 1704ms
memory: 212812kb
input:
70 300 |||||||||||| 9 13 168 66 10 2 58 25 112 60 69 1289 21 70 3 37 4 10 18 62 172 53 68 70 64 5 14 6 7 0 3 64 0 19 56 464 42 3 1 64 59 482 52 28 5 14 2 1480 48 3 59 31 18 1855 48 24 1040 2 55 2937 55 19 20 49 57 397 32 17 142 42 28 958 22 14 91 56 4 1 61 48 1853 45 1 2097 6 31 2 6 26 3048 67 37 13...
output:
4095
result:
ok single line: '4095'
Test #26:
score: 0
Accepted
time: 1856ms
memory: 212812kb
input:
70 300 |||||||||||| 60 55 25 27 49 521 63 13 9 62 23 8 5 68 768 43 5 0 42 49 792 40 40 8 11 16 257 13 46 536 8 10 768 64 11 529 45 31 1 66 28 776 37 23 1 57 51 1 19 60 16 17 28 25 68 49 257 20 70 1 44 49 24 63 23 520 46 12 16 15 18 793 53 28 16 51 54 9 44 29 17 31 39 520 11 48 280 15 12 1 45 28 9 46...
output:
793
result:
ok single line: '793'
Test #27:
score: 0
Accepted
time: 2396ms
memory: 212668kb
input:
70 300 ^^^^^^^^^^^^ 18 59 127 22 4 2671 44 16 3904 36 55 703 5 66 1473 6 60 1882 50 9 3393 11 9 1732 58 19 810 31 12 663 45 45 4031 67 4 405 63 26 819 18 21 2091 10 6 138 70 23 2777 2 31 2712 7 29 2161 23 32 1334 66 66 2637 39 27 3962 68 66 465 60 12 3205 23 11 3790 26 16 3250 5 63 3468 38 42 4026 3...
output:
4095
result:
ok single line: '4095'
Test #28:
score: 0
Accepted
time: 2413ms
memory: 212812kb
input:
70 300 ^^^^^^^^^^^^ 34 57 1 65 53 1 30 51 1 21 38 0 35 49 0 9 42 1 31 28 0 37 17 33 42 5 0 5 6 128 69 25 1 23 42 129 51 9 1 21 53 1 10 53 0 58 66 0 60 14 1 1 24 0 59 17 33 50 53 1 30 57 1 2 62 32 58 40 0 4 19 33 39 15 160 15 51 0 70 54 161 3 57 1 25 20 129 36 29 33 37 3 0 24 39 161 33 60 1 66 21 128...
output:
161
result:
ok single line: '161'
Test #29:
score: 0
Accepted
time: 2436ms
memory: 212812kb
input:
70 300 ^^^^^^^^^^^^ 20 9 55 31 56 89 39 20 175 48 49 788 63 24 126 20 39 25 6 7 762 23 24 160 55 66 257 43 45 439 20 31 103 9 43 49 6 59 213 65 54 1883 13 41 2798 19 5 3021 60 19 275 2 68 15 8 45 740 51 13 80 28 4 546 18 41 3 28 36 2220 26 35 25 46 48 50 64 29 126 29 13 878 22 19 5 43 65 23 51 21 17...
output:
4095
result:
ok single line: '4095'
Test #30:
score: 0
Accepted
time: 1015ms
memory: 212808kb
input:
70 300 &&|&&&^&&&^& 9 35 978 13 67 933 7 4 2827 39 13 376 32 33 1921 35 31 1077 34 50 248 32 7 1332 31 59 3193 46 30 3363 66 35 1718 53 56 552 67 9 2951 70 54 3615 58 58 1389 57 49 3609 29 27 1934 62 50 627 67 6 3043 24 8 2028 43 52 939 56 27 1768 5 64 2657 24 68 1358 36 7 3413 70 28 3773 5 69 1670 ...
output:
3140
result:
ok single line: '3140'
Test #31:
score: 0
Accepted
time: 808ms
memory: 212424kb
input:
70 300 &&&&&^|&|&&& 11 33 2 47 16 103 6 40 38 2 57 40 54 70 841 33 2 0 43 8 440 25 12 1610 48 37 14 48 39 0 21 54 343 4 69 172 47 53 51 47 25 6 31 20 1 25 21 2 36 40 76 28 40 225 2 53 245 19 14 51 31 13 31 30 31 91 32 34 3 5 29 1407 51 10 1 5 47 45 22 31 0 27 16 838 44 21 726 60 60 50 7 18 89 47 28 ...
output:
356
result:
ok single line: '356'
Test #32:
score: 0
Accepted
time: 750ms
memory: 211920kb
input:
70 100 &&&&&&&&&&&& 30 2 191 70 50 1011 50 27 253 35 33 27 35 16 425 33 54 554 39 1 80 49 52 66 64 26 687 15 10 26 31 42 58 25 3 443 65 57 274 63 15 59 36 13 689 9 40 186 45 34 122 45 65 120 21 5 130 30 68 1110 48 22 424 17 66 36 39 38 108 24 6 717 43 17 177 33 30 2187 70 60 588 5 62 46 41 49 595 47...
output:
-1
result:
ok single line: '-1'
Test #33:
score: 0
Accepted
time: 772ms
memory: 212432kb
input:
70 300 ^&&||&&&&|&& 54 8 148 15 41 31 40 36 921 41 10 409 5 12 148 58 51 157 18 67 667 8 58 901 41 2 10 36 66 896 9 52 271 67 55 10 53 40 17 7 37 26 16 51 17 7 8 772 30 21 394 68 59 645 24 16 786 45 42 3 36 27 513 30 14 1 46 29 387 60 54 2187 32 21 141 41 30 534 42 42 647 1 57 144 41 57 401 59 56 29...
output:
539
result:
ok single line: '539'
Test #34:
score: 0
Accepted
time: 893ms
memory: 212816kb
input:
70 300 &&^&^^&|&^|^ 26 69 131 63 32 130 19 58 0 36 44 0 21 39 3 8 34 2 67 8 1 31 38 128 58 52 5 16 4 4 61 15 0 44 5 6 27 59 129 45 5 2 17 39 131 67 21 7 66 49 1 48 70 1 62 68 6 42 70 5 44 14 128 45 33 3 45 33 133 67 55 2 16 29 6 25 44 129 10 21 129 35 63 6 67 49 130 27 14 1 46 9 6 51 10 1 42 66 4 64...
output:
132
result:
ok single line: '132'
Test #35:
score: 0
Accepted
time: 1052ms
memory: 212812kb
input:
70 300 &|^&&^&&^^^& 64 57 126 58 15 556 54 8 1 33 47 73 9 43 5 20 53 7 57 59 7 52 44 1 18 17 1658 20 35 358 18 60 0 8 1 0 5 32 293 50 11 26 33 1 48 63 57 251 37 55 76 35 21 427 27 48 3100 10 70 7 37 41 196 61 38 1 39 36 1 34 59 417 24 33 10 66 41 1 63 15 467 33 18 18 7 28 65 10 68 0 24 21 134 46 33 ...
output:
1831
result:
ok single line: '1831'
Test #36:
score: 0
Accepted
time: 1062ms
memory: 212812kb
input:
70 300 ^^^|^^&|^&&& 36 42 1960 55 57 12 66 46 25 27 37 74 9 32 102 24 40 70 7 19 90 21 35 88 62 25 2225 50 54 321 55 65 152 19 63 107 61 69 240 31 61 23 62 26 1273 11 3 28 44 43 453 12 14 391 14 63 443 65 49 362 39 44 2 57 51 45 14 52 9 13 11 174 23 11 1034 10 59 91 35 30 685 39 2 229 35 3 61 13 56 ...
output:
447
result:
ok single line: '447'
Test #37:
score: 0
Accepted
time: 1790ms
memory: 212812kb
input:
70 300 ^^^^&|^&^^|^ 26 12 755 28 45 2296 5 51 3715 25 33 3577 57 40 3629 7 10 2316 9 33 483 34 29 3150 5 10 3817 5 52 2452 19 43 3908 54 59 3809 9 27 3900 48 59 1342 12 10 518 7 34 3800 44 55 1620 32 42 2646 9 15 2476 31 23 1187 5 65 1572 31 55 519 36 59 796 38 29 887 30 7 536 20 54 2511 54 52 155 1...
output:
3951
result:
ok single line: '3951'
Test #38:
score: 0
Accepted
time: 928ms
memory: 212816kb
input:
70 300 |^^^^^^&&&^& 9 35 1024 21 11 164 29 21 32 31 36 40 45 69 0 23 25 12 54 66 140 45 68 1028 51 64 128 31 1 4 13 66 40 8 31 4 63 34 132 22 64 4 10 54 0 19 50 12 2 53 8 51 23 0 34 68 0 62 18 32 26 69 0 51 34 0 8 38 0 8 2 132 49 38 12 26 15 0 12 59 0 46 61 0 29 8 8 67 59 0 22 67 4 70 36 36 17 32 40...
output:
1068
result:
ok single line: '1068'
Test #39:
score: 0
Accepted
time: 1476ms
memory: 212808kb
input:
70 300 |^^|&^^|^&^^ 43 65 16 48 6 272 35 15 0 58 65 17 62 10 273 38 35 1 24 56 17 7 43 0 45 34 16 24 45 16 20 61 0 58 64 257 52 21 17 42 6 16 67 55 1 37 60 17 37 6 0 14 66 256 49 43 17 39 4 17 56 18 1 16 3 0 52 60 17 23 65 272 26 60 273 2 52 0 23 49 17 19 68 257 47 22 1 51 3 1 4 41 1 27 57 1 40 22 0...
output:
257
result:
ok single line: '257'
Test #40:
score: 0
Accepted
time: 988ms
memory: 212808kb
input:
70 500 &&&&&&&&&&&& 59 35 1190 19 22 947 20 34 1135 55 47 2788 6 18 3576 6 50 1558 62 58 2183 69 31 2215 28 38 360 27 17 3532 38 66 2725 17 14 3209 47 34 1592 48 49 1305 63 68 3854 67 45 3856 1 58 3976 3 5 817 33 47 819 51 69 153 5 10 1249 35 34 1559 16 27 500 58 40 1122 67 6 103 31 51 485 27 48 293...
output:
2048
result:
ok single line: '2048'
Test #41:
score: 0
Accepted
time: 734ms
memory: 212796kb
input:
70 500 &&&&&&&&&&&& 14 43 17 28 21 17 19 57 1 46 43 1 11 40 1 41 16 16 50 44 1 2 19 129 34 30 1 64 45 1 12 63 1 23 50 1 59 63 16 66 60 128 31 59 1 13 67 1 70 48 400 44 11 0 5 53 1 64 27 257 18 8 17 17 3 1 29 50 0 23 50 0 15 57 144 44 45 1 21 67 401 70 33 0 28 41 17 51 21 401 60 4 0 26 59 17 4 69 0 4...
output:
16
result:
ok single line: '16'
Test #42:
score: 0
Accepted
time: 892ms
memory: 212812kb
input:
70 500 &&&&&&&&&&&& 34 60 308 22 69 56 24 46 34 15 46 959 44 14 215 47 36 3157 36 35 49 10 6 157 61 17 143 23 22 889 22 67 121 9 49 13 55 64 77 59 50 40 27 54 577 12 42 24 38 61 949 15 58 1074 24 25 753 30 50 1213 65 54 401 41 21 1363 66 32 442 67 21 1740 21 9 632 62 25 21 30 36 247 63 14 290 46 56 ...
output:
128
result:
ok single line: '128'
Test #43:
score: 0
Accepted
time: 767ms
memory: 210508kb
input:
70 100 |||||||||||| 20 42 235 69 65 841 68 60 8 17 45 2067 64 4 1080 25 41 2664 22 32 359 38 26 3178 37 21 2102 32 10 2938 18 26 387 60 33 3279 18 8 1428 10 34 2278 54 29 768 56 55 3837 63 52 995 54 4 3857 43 17 1627 2 23 125 9 59 1613 37 53 3852 44 26 3720 15 15 268 42 45 3503 67 9 3533 45 38 528 5...
output:
-1
result:
ok single line: '-1'
Test #44:
score: 0
Accepted
time: 1785ms
memory: 212812kb
input:
70 500 |||||||||||| 25 18 642 35 25 512 65 17 2178 66 13 706 31 61 2754 50 15 2688 68 22 64 50 59 2112 67 62 2 6 20 2688 14 67 2050 24 47 192 55 23 130 45 40 192 39 51 706 1 62 2690 6 66 2624 56 4 642 59 9 512 25 46 64 55 11 2050 19 13 66 16 4 2754 1 61 2560 42 20 2242 15 62 704 61 65 578 67 16 2752...
output:
2754
result:
ok single line: '2754'
Test #45:
score: 0
Accepted
time: 1950ms
memory: 212808kb
input:
70 500 |||||||||||| 14 66 117 1 18 3 67 14 1 14 24 1 11 21 3 51 35 7 38 43 79 5 28 80 5 65 1412 1 7 384 30 51 31 47 12 19 61 24 499 66 6 225 4 48 917 57 37 414 5 24 3945 24 63 1 38 20 46 27 12 3603 63 3 126 22 23 63 35 60 0 68 42 14 24 52 244 52 27 10 33 68 1 60 8 100 56 52 1471 48 37 4 49 44 3 47 3...
output:
4095
result:
ok single line: '4095'
Test #46:
score: 0
Accepted
time: 1362ms
memory: 212812kb
input:
70 500 |||||||||||| 6 69 4017 13 59 1767 40 61 175 19 49 771 1 54 647 36 20 107 39 65 59 4 64 16 43 35 1582 48 40 94 31 42 1754 21 32 1744 23 69 58 68 23 41 5 40 189 63 37 86 67 52 388 55 55 19 65 40 73 53 23 8 10 68 366 8 25 6 56 14 85 15 38 29 8 51 22 31 58 1473 56 69 192 22 63 390 9 41 1050 18 8 ...
output:
4095
result:
ok single line: '4095'
Test #47:
score: 0
Accepted
time: 2488ms
memory: 212812kb
input:
70 500 ^^^^^^^^^^^^ 28 53 1811 66 50 2481 18 60 476 9 8 683 8 14 304 57 17 3030 56 30 787 49 32 3227 32 4 1777 44 16 566 16 50 2655 50 30 463 25 27 3736 45 59 2727 67 12 3767 1 4 680 41 9 2488 12 49 177 57 22 3090 54 67 2504 41 20 1872 20 61 2234 45 54 1523 54 24 2488 36 30 1368 56 47 2413 16 22 289...
output:
4095
result:
ok single line: '4095'
Test #48:
score: 0
Accepted
time: 2479ms
memory: 212764kb
input:
70 500 ^^^^^^^^^^^^ 65 48 16 3 10 16 23 7 33 29 45 1 7 1 33 61 12 49 49 38 0 57 23 49 55 55 1 20 26 1 2 31 17 42 63 48 21 29 0 33 68 48 58 20 0 10 4 0 57 13 33 2 39 1 24 2 0 32 13 0 38 17 0 43 22 0 27 2 16 5 28 17 21 69 0 9 62 17 59 42 48 4 45 49 7 44 0 34 37 0 68 4 0 10 37 17 42 4 0 65 8 0 46 52 16...
output:
2097
result:
ok single line: '2097'
Test #49:
score: 0
Accepted
time: 2481ms
memory: 214856kb
input:
70 500 ^^^^^^^^^^^^ 63 27 0 18 56 0 25 16 0 4 33 0 14 39 0 3 63 0 37 67 1028 25 42 4 3 22 1028 60 14 4 22 7 4 16 64 0 19 41 4 34 46 0 40 30 4 33 33 4 13 36 0 51 58 0 35 27 4 58 61 0 39 9 0 66 32 0 39 57 4 38 1 4 17 31 1028 56 57 0 59 43 4 30 43 4 52 38 0 39 35 1028 56 65 4 21 9 4 22 4 4 30 59 0 24 5...
output:
1028
result:
ok single line: '1028'
Test #50:
score: 0
Accepted
time: 796ms
memory: 212812kb
input:
70 500 |&|&&&^&&&&| 25 38 2076 39 21 1284 15 2 2328 64 29 2048 46 28 3080 56 38 1300 2 17 2076 55 44 3072 55 22 3328 6 58 3096 62 59 2072 53 1 2324 26 45 20 40 8 16 18 19 3348 32 59 1040 27 11 1048 19 66 1044 40 60 3076 38 20 2332 27 11 1024 24 68 1036 27 14 276 64 23 264 43 63 16 51 3 0 42 45 24 34...
output:
3076
result:
ok single line: '3076'
Test #51:
score: 0
Accepted
time: 1005ms
memory: 212816kb
input:
70 500 |&&&&^&|&&^^ 67 68 17 19 30 5 36 37 3 42 26 2 50 44 1 8 51 89 32 21 2 9 47 2610 7 49 1 15 42 1677 7 65 2 25 16 1 23 26 10 23 26 148 16 36 61 11 60 2 38 35 1 49 62 182 8 35 57 24 47 463 7 52 5 62 3 361 30 25 82 7 59 140 70 46 11 56 40 14 11 69 5 39 68 371 59 6 352 61 68 4 13 15 140 17 69 256 6...
output:
3241
result:
ok single line: '3241'
Test #52:
score: 0
Accepted
time: 906ms
memory: 212772kb
input:
70 500 ^&&&&|&&&&&& 28 58 152 57 29 808 10 53 177 3 56 1290 37 2 117 59 45 100 34 30 229 70 4 162 25 17 103 11 2 78 15 42 1570 38 58 134 54 45 36 22 18 466 40 45 4072 25 9 3894 48 2 203 14 12 124 25 34 726 58 39 109 37 17 93 34 26 2566 28 22 965 53 26 253 59 30 838 68 42 69 2 44 11 56 29 73 34 15 66...
output:
289
result:
ok single line: '289'
Test #53:
score: 0
Accepted
time: 914ms
memory: 212812kb
input:
70 500 &&&^^|&&^&&| 29 43 10 20 57 3 57 48 522 54 28 1 39 58 10 2 44 1033 52 12 1537 33 4 3 39 46 3 39 62 521 23 49 1026 61 47 1034 48 66 1537 69 33 514 52 54 1033 9 9 2 60 37 9 35 15 1539 27 14 513 55 10 521 14 39 1546 9 32 1035 7 34 9 45 16 9 65 39 1026 1 31 1539 36 11 1027 29 55 522 49 27 0 9 13 ...
output:
1032
result:
ok single line: '1032'
Test #54:
score: 0
Accepted
time: 1960ms
memory: 210760kb
input:
70 100 |||||||||||| 57 22 0 31 36 0 6 43 0 16 40 0 63 42 128 7 44 0 30 64 0 23 4 0 59 51 192 8 43 0 9 37 192 54 53 128 65 21 64 21 50 0 23 54 0 45 18 0 62 47 64 58 39 0 66 46 0 54 57 0 46 65 0 57 60 0 32 41 0 11 59 0 2 1 0 1 42 0 33 58 0 14 53 0 28 31 0 13 36 192 35 3 128 14 10 0 60 27 0 11 64 0 25 ...
output:
-1
result:
ok single line: '-1'
Test #55:
score: 0
Accepted
time: 788ms
memory: 212816kb
input:
70 500 &&^||&&|^&&& 1 13 27 55 12 0 26 24 0 59 36 1 43 52 25 62 33 155 68 55 1 44 56 8 58 17 1 46 11 16 27 22 147 53 68 154 36 13 16 64 65 2064 3 19 10 67 33 11 37 67 2 48 22 2185 62 39 147 35 42 1 31 55 129 53 34 3 43 46 2 15 29 145 37 33 10 35 56 2 31 9 8 67 29 128 41 58 3 44 24 10 6 42 153 38 36 ...
output:
154
result:
ok single line: '154'
Test #56:
score: 0
Accepted
time: 908ms
memory: 212812kb
input:
70 500 ^&^&&&&|&&&& 33 16 62 64 31 1311 4 20 17 58 35 21 51 15 1830 27 4 444 48 2 1322 43 3 507 34 40 12 8 37 565 10 34 1575 62 4 2535 67 69 196 35 52 236 59 4 6 43 28 156 25 68 425 20 55 243 44 7 376 58 12 39 34 58 339 42 18 222 27 51 88 15 70 1043 37 34 282 56 5 218 9 58 4093 45 68 188 60 41 17 51...
output:
165
result:
ok single line: '165'
Test #57:
score: 0
Accepted
time: 2220ms
memory: 212764kb
input:
70 500 |^&||||^^^^| 2 21 0 59 60 548 27 16 32 55 63 32 13 22 36 24 14 560 22 15 564 69 37 548 43 35 48 8 40 560 70 29 32 29 2 52 32 31 564 42 39 20 70 61 4 12 31 548 25 41 16 57 17 16 25 13 528 66 14 32 51 56 560 42 27 512 16 14 548 32 23 544 16 37 544 32 17 532 57 15 564 2 2 20 39 28 48 54 12 52 27...
output:
564
result:
ok single line: '564'
Test #58:
score: 0
Accepted
time: 1178ms
memory: 212772kb
input:
70 500 &^^^^&^^|||& 9 14 4 41 65 0 26 38 524 46 5 1796 50 57 8 21 67 776 67 36 5 26 48 261 36 70 12 12 52 5 19 69 0 6 55 769 10 34 264 58 12 5 2 40 769 27 27 1 18 24 1 9 33 1 41 44 1 14 59 5 44 39 5 33 52 8 37 60 0 61 67 0 49 30 8 45 43 8 28 57 4 61 67 268 19 52 12 36 59 0 34 9 4 52 15 0 40 9 0 15 5...
output:
1805
result:
ok single line: '1805'
Test #59:
score: 0
Accepted
time: 1319ms
memory: 212812kb
input:
70 500 ^|^^^^^|^^&& 44 20 128 66 47 2 62 45 2186 4 37 136 37 25 0 48 19 128 42 10 128 37 13 8 52 5 8 45 64 2178 2 3 131 43 51 1 47 39 128 41 34 10 22 15 11 2 30 0 58 22 2 65 16 1 1 40 129 40 13 2050 16 16 2 42 5 1 47 2 8 52 32 2058 51 15 130 36 10 137 68 53 2058 63 23 8 34 39 8 28 19 2 1 16 9 26 12 ...
output:
139
result:
ok single line: '139'
Test #60:
score: 0
Accepted
time: 756ms
memory: 212812kb
input:
70 1000 &&&&&&&&&&&& 63 41 1044 66 38 1233 24 14 1217 23 41 1024 27 42 1217 70 46 196 37 15 0 47 16 145 29 60 81 38 27 197 66 50 1157 2 31 1221 46 18 1168 68 54 208 70 12 16 57 34 149 50 60 0 70 2 5 31 21 84 47 33 5 43 27 132 64 44 149 66 9 1025 3 59 1092 46 59 1024 46 32 1232 24 30 1029 48 70 5 12 ...
output:
1216
result:
ok single line: '1216'
Test #61:
score: 0
Accepted
time: 861ms
memory: 212812kb
input:
70 1000 &&&&&&&&&&&& 8 51 760 51 20 151 45 38 334 64 68 68 23 45 0 8 16 2 58 38 4 2 26 1 55 20 7 44 37 4 31 39 1 56 58 2627 35 42 208 56 43 1 60 52 40 20 9 24 41 10 15 22 2 8 18 50 80 46 41 3 57 10 204 42 47 53 22 59 226 26 19 1624 45 22 8 69 12 1 57 25 62 26 42 4021 30 47 2 30 15 365 30 11 2 63 7 0...
output:
128
result:
ok single line: '128'
Test #62:
score: 0
Accepted
time: 948ms
memory: 212808kb
input:
70 1000 &&&&&&&&&&&& 24 16 202 6 61 540 56 31 1660 1 35 2724 12 46 89 14 34 82 4 53 492 45 53 50 26 28 124 19 69 460 20 30 37 28 4 34 28 29 493 44 9 1131 23 60 128 62 4 121 12 19 1498 60 14 27 4 51 1037 52 40 1290 15 21 1002 67 20 37 45 70 339 50 67 116 48 57 61 44 29 33 20 14 130 61 44 355 15 53 33...
output:
1024
result:
ok single line: '1024'
Test #63:
score: 0
Accepted
time: 1107ms
memory: 214860kb
input:
70 1000 |||||||||||| 48 14 123 56 59 874 62 70 952 56 40 2829 31 46 1078 44 20 595 1 18 1325 2 14 3854 22 63 3994 52 69 380 39 55 1546 47 43 82 54 65 674 55 62 2357 20 35 2876 55 3 164 40 13 2715 53 2 962 44 11 3132 65 52 286 28 53 2345 18 32 3250 38 55 73 31 53 1365 50 55 1957 6 16 68 52 10 2867 15...
output:
4095
result:
ok single line: '4095'
Test #64:
score: 0
Accepted
time: 2448ms
memory: 212812kb
input:
70 1000 |||||||||||| 53 22 0 46 40 0 54 65 1152 64 67 144 64 38 16 25 36 0 41 55 1616 16 54 0 37 67 192 24 43 0 41 32 0 51 8 576 29 32 0 45 28 1168 37 54 0 21 29 80 58 46 1024 53 22 80 19 30 0 23 5 0 50 7 0 14 49 0 69 3 0 34 17 1616 52 14 80 16 54 640 24 50 656 63 3 0 32 3 1216 44 44 192 54 7 0 11 5...
output:
3792
result:
ok single line: '3792'
Test #65:
score: 0
Accepted
time: 936ms
memory: 210256kb
input:
70 100 |||||||||||| 9 61 0 4 34 12 68 6 53 19 25 330 49 29 403 21 20 51 35 32 3898 10 34 3624 49 21 515 1 24 41 39 27 140 8 16 210 57 52 160 46 48 99 18 16 27 33 47 3853 69 55 696 15 70 1629 2 12 400 33 46 10 41 7 46 67 13 366 34 43 1150 40 61 218 50 12 1430 12 64 18 15 25 95 45 1 8 16 41 18 66 6 15...
output:
-1
result:
ok single line: '-1'
Test #66:
score: 0
Accepted
time: 1664ms
memory: 212812kb
input:
70 1000 |||||||||||| 34 35 292 40 67 53 10 38 698 56 40 586 20 51 170 1 40 115 28 27 2086 17 67 11 63 44 808 65 62 148 59 11 72 13 64 774 67 5 257 38 33 245 56 56 21 61 49 156 64 46 6 45 37 45 47 21 11 35 12 3005 21 36 868 68 54 42 40 46 635 39 13 19 29 19 969 68 49 299 50 70 2005 20 9 1815 59 25 19...
output:
4095
result:
ok single line: '4095'
Test #67:
score: 0
Accepted
time: 2530ms
memory: 212736kb
input:
70 1000 ^^^^^^^^^^^^ 28 61 2940 3 18 1987 2 64 89 10 38 1765 30 40 1121 70 57 1347 10 39 1642 67 24 2217 10 29 578 14 9 1772 10 16 968 22 63 3759 35 1 1654 30 45 952 62 34 822 48 64 2786 67 33 3172 43 14 297 56 21 3408 10 45 501 62 69 2961 41 39 2237 63 56 510 41 33 3963 21 3 2832 16 40 2289 13 68 2...
output:
4095
result:
ok single line: '4095'
Test #68:
score: 0
Accepted
time: 2537ms
memory: 212816kb
input:
70 1000 ^^^^^^^^^^^^ 44 16 2 46 47 1 17 2 8 15 65 0 13 45 3 17 37 3 49 42 265 36 62 0 51 9 1 42 26 9 40 16 2 58 55 11 38 29 9 31 18 0 29 67 1 26 30 1 33 58 3 36 60 3 65 52 1 44 26 10 35 5 522 54 45 0 39 50 0 49 36 770 35 30 259 9 4 9 43 69 2561 3 47 258 69 46 2 51 63 11 69 67 2306 1 26 2 8 47 8 34 5...
output:
2827
result:
ok single line: '2827'
Test #69:
score: 0
Accepted
time: 2519ms
memory: 212688kb
input:
70 1000 ^^^^^^^^^^^^ 27 65 4 23 45 115 23 55 2457 32 29 206 63 60 92 53 12 499 62 13 17 53 26 71 55 18 464 47 45 79 46 56 56 15 46 209 8 54 2172 28 26 42 30 41 207 2 4 7 22 53 186 45 29 220 23 11 182 45 6 3598 40 8 38 66 38 174 61 66 457 43 15 496 18 4 30 65 27 14 25 54 14 4 15 210 18 45 461 69 65 2...
output:
4095
result:
ok single line: '4095'
Test #70:
score: 0
Accepted
time: 1857ms
memory: 212816kb
input:
70 1000 |^^&^&|&|^^| 51 39 3151 16 60 1023 1 65 1623 24 58 1381 6 41 1757 17 55 2639 65 38 1839 46 44 2874 65 35 926 5 51 1324 56 6 673 55 1 2336 14 59 1956 26 22 1700 15 13 35 70 29 3099 10 22 1399 37 7 861 63 40 1355 58 47 2545 51 2 864 47 49 2470 45 41 3053 39 54 1413 33 10 2117 65 46 1698 58 18 ...
output:
4087
result:
ok single line: '4087'
Test #71:
score: 0
Accepted
time: 776ms
memory: 212812kb
input:
70 1000 ^&^&&|^&&&|& 65 28 12 42 60 65 12 61 76 17 15 1 51 61 5 34 3 0 50 36 9 13 35 13 55 43 5 43 27 77 29 7 72 36 18 0 47 69 5 45 9 65 37 68 77 26 58 4 58 33 5 41 17 5 35 70 1 60 7 4 70 61 68 16 34 12 61 51 0 61 4 1 33 5 1 66 41 8 34 3 68 63 48 1 26 63 69 60 66 76 42 37 1 68 57 4 14 26 9 68 65 0 2...
output:
77
result:
ok single line: '77'
Test #72:
score: 0
Accepted
time: 1216ms
memory: 212684kb
input:
70 1000 &&^^^&&&&&|& 44 6 2308 70 56 104 60 60 2234 22 61 53 4 60 1708 35 49 197 61 29 277 33 23 36 57 46 152 68 36 81 23 46 179 34 32 985 33 3 18 35 33 567 48 51 53 17 47 1329 1 38 77 33 44 3690 15 66 497 4 42 255 44 13 24 24 43 99 4 2 35 39 18 418 45 38 46 46 52 26 32 53 67 25 58 122 65 28 917 11 ...
output:
1596
result:
ok single line: '1596'
Test #73:
score: 0
Accepted
time: 899ms
memory: 212812kb
input:
70 1000 |&^^&&&&^&&& 57 69 2465 4 36 2360 61 14 2492 58 19 2468 68 56 2062 34 35 2333 10 47 2089 59 69 314 65 43 303 49 63 30 61 49 2449 33 49 45 50 54 155 33 22 318 66 43 2432 60 22 2079 37 35 60 46 52 63 12 14 52 37 49 394 63 66 2225 48 68 2432 64 58 2180 2 26 2181 62 5 56 25 57 2357 51 24 2439 8 ...
output:
2445
result:
ok single line: '2445'
Test #74:
score: 0
Accepted
time: 983ms
memory: 214816kb
input:
70 1000 &&^|&^&&&|&& 45 6 71 65 65 3 23 22 102 21 61 3 32 23 7 11 66 24 5 44 16 46 57 3 36 40 96 45 15 209 6 18 2 22 61 14 18 45 7 40 31 49 45 67 672 56 51 9 1 61 126 15 38 0 16 46 0 26 17 0 70 2 423 34 60 173 19 32 360 28 59 495 61 28 101 8 61 1216 10 38 1 15 65 9 56 10 10 58 31 12 59 11 3 47 64 26...
output:
684
result:
ok single line: '684'
Test #75:
score: 0
Accepted
time: 1185ms
memory: 212812kb
input:
70 1000 &&&^^^&&||&& 18 69 70 4 26 30 1 15 102 1 2 269 6 39 2873 33 21 115 12 21 33 44 23 14 37 10 1013 63 63 503 16 1 59 24 44 3 20 62 1626 16 37 19 53 49 1 67 68 9 16 61 287 56 47 1903 70 64 58 46 24 270 50 28 3969 55 43 206 40 59 51 69 60 354 30 61 51 44 36 44 65 50 229 48 41 2299 54 10 2935 64 2...
output:
1848
result:
ok single line: '1848'
Test #76:
score: 0
Accepted
time: 1934ms
memory: 212040kb
input:
70 100 ^^^^^^^^^^^^ 35 7 529 57 63 136 2 15 528 52 44 9 50 13 650 53 29 659 63 36 1 37 57 642 14 62 25 11 29 145 34 17 531 17 65 144 18 20 649 56 3 641 15 62 153 15 6 515 49 3 10 3 32 537 22 69 128 64 49 656 13 65 138 27 66 24 5 69 137 69 3 513 24 38 26 39 51 25 50 31 537 49 41 27 23 4 664 7 47 664 ...
output:
-1
result:
ok single line: '-1'
Test #77:
score: 0
Accepted
time: 2012ms
memory: 212812kb
input:
70 1000 ^^&|&^|^^|&^ 60 5 1402 13 48 1820 65 54 3063 7 43 330 19 41 1103 35 16 4052 6 34 9 37 1 2797 13 68 1752 28 34 416 30 11 3514 34 14 2569 49 7 2950 67 24 3194 23 16 3969 51 10 717 19 37 1269 36 52 3734 58 37 1363 22 55 1582 43 33 1283 25 19 2851 18 18 1054 30 16 3987 31 19 2184 53 19 2405 7 64...
output:
4091
result:
ok single line: '4091'
Test #78:
score: 0
Accepted
time: 1232ms
memory: 212776kb
input:
70 1000 |||^|&&^&&^^ 8 24 166 47 9 1 62 15 176 7 42 0 16 20 1 30 11 8 1 38 0 44 58 7 61 56 117 33 13 423 58 7 345 13 33 1249 41 16 1 60 9 71 20 9 0 11 28 3430 5 5 494 22 66 126 57 67 408 34 50 3928 4 68 360 34 18 104 38 46 372 36 23 88 2 28 4 45 45 581 33 35 19 23 51 240 38 44 39 55 25 0 48 34 17 66...
output:
3295
result:
ok single line: '3295'
Test #79:
score: 0
Accepted
time: 1573ms
memory: 212816kb
input:
70 1000 ^&|^^^^^^&|& 38 50 895 34 37 495 16 15 1859 24 29 101 47 45 437 8 5 199 7 17 806 27 23 32 58 27 59 49 25 54 61 12 185 25 5 21 5 47 979 63 35 513 36 65 464 42 62 459 6 44 1104 56 18 44 30 17 4 7 45 100 6 54 1148 39 46 459 17 68 39 14 62 11 13 9 118 54 45 2740 37 51 2 65 18 782 70 20 225 46 60...
output:
2045
result:
ok single line: '2045'
Test #80:
score: 0
Accepted
time: 1438ms
memory: 212808kb
input:
70 2000 &&&&&&&&&&&& 12 12 2283 8 33 643 46 65 1265 1 9 622 24 28 2744 48 41 2925 7 29 3734 44 11 49 69 56 1459 53 27 20 60 37 1620 25 65 1191 8 18 3016 20 30 2630 58 60 1126 5 42 1578 58 12 1552 43 27 560 21 4 597 45 28 4062 46 4 534 70 27 921 62 5 118 52 12 952 58 24 3162 47 28 2866 17 33 1330 58 ...
output:
3584
result:
ok single line: '3584'
Test #81:
score: 0
Accepted
time: 746ms
memory: 212772kb
input:
70 2000 &&&&&&&&&&&& 15 42 32 67 4 1 10 32 33 36 45 33 35 25 0 51 30 1 47 43 0 28 23 1 68 66 544 39 6 17 59 4 1 34 63 16 55 48 33 39 38 65 67 19 1 58 42 17 61 5 48 53 55 97 65 46 0 61 59 0 55 18 112 44 41 33 47 30 113 36 11 1 44 12 0 6 1 0 30 4 64 9 67 0 48 67 17 42 59 0 60 67 0 22 18 609 63 70 0 9 ...
output:
544
result:
ok single line: '544'
Test #82:
score: 0
Accepted
time: 1038ms
memory: 212816kb
input:
70 2000 &&&&&&&&&&&& 12 7 133 39 8 416 18 21 11 66 61 174 43 47 1628 36 39 4 64 50 228 37 17 50 4 43 449 29 47 250 27 54 782 26 22 3766 62 43 30 10 48 589 6 28 3260 61 24 53 23 23 83 17 15 131 67 56 1 69 5 1311 61 17 963 27 54 342 34 25 465 4 17 206 62 18 11 38 70 14 35 41 377 28 43 36 66 9 16 24 33...
output:
1280
result:
ok single line: '1280'
Test #83:
score: 0
Accepted
time: 1369ms
memory: 212816kb
input:
70 2000 |||||||||||| 66 27 1424 51 59 2953 69 30 2487 29 65 2190 18 2 3858 28 37 3217 14 23 765 51 47 3650 45 54 1583 28 23 3355 16 65 1912 44 5 1575 12 13 1263 60 68 2996 6 15 1130 52 20 3246 18 24 805 44 54 1563 63 47 1285 53 44 2304 61 4 3497 15 22 3002 17 25 2800 37 65 2640 25 40 2069 22 36 2532...
output:
4095
result:
ok single line: '4095'
Test #84:
score: 0
Accepted
time: 2424ms
memory: 212812kb
input:
70 2000 |||||||||||| 26 48 9 41 20 32 1 13 7 64 56 26 3 69 3 56 8 38 21 58 49 7 36 1807 40 6 99 41 39 0 22 38 322 57 49 131 49 18 207 15 22 0 22 56 0 53 50 15 47 36 0 6 70 7 29 57 2953 46 27 16 25 9 313 20 22 5 31 50 3 4 62 1428 61 57 0 55 23 81 28 15 325 64 24 15 70 9 1577 7 27 3023 45 63 0 3 6 248...
output:
4095
result:
ok single line: '4095'
Test #85:
score: 0
Accepted
time: 1954ms
memory: 212812kb
input:
70 2000 |||||||||||| 51 51 117 18 29 232 4 7 828 13 38 485 60 24 52 38 60 2547 65 49 47 62 15 198 60 26 117 30 15 143 47 32 414 68 35 739 27 65 2575 30 30 561 47 39 461 15 43 188 4 51 43 57 35 38 51 7 878 63 10 107 67 57 97 7 69 118 21 52 2684 12 26 402 26 66 1023 25 47 79 38 59 2806 14 52 2935 32 4...
output:
4095
result:
ok single line: '4095'
Test #86:
score: 0
Accepted
time: 2554ms
memory: 212772kb
input:
70 2000 ^^^^^^^^^^^^ 22 61 3234 53 14 3072 27 9 146 25 58 2178 25 21 3104 5 38 1024 64 65 1042 26 62 1058 52 41 2050 15 29 1026 64 5 2080 31 58 50 41 53 160 43 63 3074 63 53 2082 50 68 1024 31 7 1040 69 5 1154 34 70 1058 19 16 128 63 22 2178 19 55 3088 20 52 2192 32 8 3120 15 48 1168 45 16 48 6 70 1...
output:
3250
result:
ok single line: '3250'
Test #87:
score: 0
Accepted
time: 1988ms
memory: 209792kb
input:
70 100 ^^^^^^^^^^^^ 43 19 0 52 27 0 37 47 1 25 59 0 42 15 0 37 40 0 69 59 1 53 56 0 52 24 0 54 29 1 51 23 0 27 9 1 51 11 1 37 68 0 2 12 0 6 65 0 67 58 1 21 11 1024 62 54 0 13 46 1 38 69 1 66 40 1 31 13 1 26 68 0 23 58 1 55 42 1 54 23 0 42 31 1 46 9 0 58 4 0 29 30 0 54 23 0 61 5 1 47 19 0 16 59 0 40 ...
output:
-1
result:
ok single line: '-1'
Test #88:
score: 0
Accepted
time: 2555ms
memory: 212816kb
input:
70 2000 ^^^^^^^^^^^^ 29 6 145 3 10 0 14 50 128 56 41 17 42 12 192 62 39 64 39 45 17 22 6 1 15 22 0 30 6 0 23 46 145 40 11 1 63 32 81 50 35 64 49 48 0 35 32 17 5 28 145 5 2 81 14 58 17 11 40 208 41 1 64 33 27 17 63 69 17 4 53 65 7 24 65 4 55 2193 41 4 16 18 28 17 58 11 1 46 60 1 29 62 1 46 69 0 32 53...
output:
2257
result:
ok single line: '2257'
Test #89:
score: 0
Accepted
time: 2574ms
memory: 212808kb
input:
70 2000 ^^^^^^^^^^^^ 43 48 6 4 20 1318 6 58 14 12 15 12 40 70 11 31 38 549 61 65 813 61 35 41 36 17 1070 7 28 1583 41 16 42 64 14 15 67 5 1325 3 5 33 55 56 42 53 10 1290 34 7 35 19 30 32 13 63 32 20 12 35 48 68 291 55 25 3 8 27 43 63 43 264 15 3 8 60 13 811 41 27 300 53 65 296 68 10 15 30 54 34 11 5...
output:
1839
result:
ok single line: '1839'
Test #90:
score: 0
Accepted
time: 1155ms
memory: 214852kb
input:
70 2000 &^||&|&^&|&^ 11 2 513 28 69 1681 48 29 129 54 11 1552 48 68 1040 24 30 1041 39 2 128 21 50 1024 53 40 1664 18 2 1553 11 6 656 1 2 513 55 33 1024 42 57 657 7 67 1168 11 36 1025 21 20 1025 27 68 640 63 40 1153 9 7 1152 5 46 1665 1 39 1025 49 66 1553 53 48 513 24 35 641 26 31 144 52 42 1681 34 ...
output:
1681
result:
ok single line: '1681'
Test #91:
score: 0
Accepted
time: 836ms
memory: 212808kb
input:
70 2000 &|&&&^|^&&|| 22 39 0 5 30 0 41 24 0 61 9 352 50 18 256 1 4 64 59 55 0 2 16 0 37 1 80 36 30 0 17 11 48 25 70 96 21 9 32 19 29 368 66 6 0 42 31 0 18 47 336 47 6 0 38 47 0 59 69 272 5 43 16 59 69 16 20 16 64 66 69 0 11 62 16 47 26 16 30 52 0 51 18 0 50 46 256 26 45 64 21 59 0 68 61 0 17 47 32 5...
output:
352
result:
ok single line: '352'
Test #92:
score: 0
Accepted
time: 1220ms
memory: 214724kb
input:
70 2000 &^&&&&&|&^&& 25 8 95 41 69 469 8 66 16 36 50 23 60 36 195 53 23 2510 21 36 21 34 64 2006 65 25 317 33 16 60 63 44 15 65 64 417 70 62 100 41 6 12 33 41 1714 24 15 1545 60 53 759 3 37 339 59 16 1080 56 70 1061 30 52 243 13 22 273 23 42 113 63 24 880 35 17 5 6 53 1535 42 52 2 11 36 228 38 16 84...
output:
2690
result:
ok single line: '2690'
Test #93:
score: 0
Accepted
time: 1829ms
memory: 212808kb
input:
70 2000 &||&^^|&^&|& 55 14 1407 51 8 1775 32 2 2696 19 62 1803 53 9 2248 35 6 141 45 34 1708 46 52 1557 52 27 2245 41 68 1618 60 27 1157 50 13 2337 40 33 2254 58 33 4022 34 21 1098 41 21 2624 18 62 1528 47 59 2287 32 48 3455 11 16 2209 41 48 557 31 22 3605 49 27 3268 17 49 3407 12 37 3462 31 16 1254...
output:
4094
result:
ok single line: '4094'
Test #94:
score: 0
Accepted
time: 1158ms
memory: 212812kb
input:
70 2000 &&&&&^|&|&^& 62 51 597 13 27 16 63 54 1 21 53 15 38 70 2429 32 69 1398 10 37 28 53 65 65 8 65 3556 3 10 3351 17 6 1 46 10 0 10 36 355 63 2 115 24 12 14 12 45 251 61 53 3 11 48 6 63 19 410 50 39 1 3 8 0 69 19 203 36 68 0 49 4 135 24 33 19 48 46 180 65 20 1042 38 21 1672 1 70 161 13 56 2 56 37...
output:
1888
result:
ok single line: '1888'
Test #95:
score: 0
Accepted
time: 1592ms
memory: 212808kb
input:
70 2000 &|&|&|^&||^& 8 31 30 15 6 652 59 55 143 35 22 16 19 10 144 15 25 155 60 31 140 2 7 136 69 34 29 41 61 668 38 37 1169 54 55 3 61 56 137 30 59 156 63 10 646 10 20 13 48 53 0 69 11 24 30 66 8 49 12 28 47 28 134 1 26 131 16 49 11 9 61 24 13 44 12 68 34 27 22 5 31 46 46 531 63 56 27 43 60 158 51 ...
output:
1694
result:
ok single line: '1694'
Test #96:
score: 0
Accepted
time: 1622ms
memory: 212812kb
input:
70 2000 ^|^^|||^^^&^ 49 29 516 5 45 640 27 58 2944 48 36 772 70 9 516 12 9 2580 41 34 272 38 57 2560 62 39 900 37 26 2948 63 42 2944 3 35 400 18 36 528 11 5 644 37 39 916 62 54 2180 63 43 2176 20 53 2960 14 51 528 65 37 916 13 13 2688 63 5 640 11 45 272 40 40 144 34 20 2052 27 68 388 66 34 2432 56 2...
output:
2964
result:
ok single line: '2964'
Test #97:
score: 0
Accepted
time: 1876ms
memory: 212648kb
input:
70 2000 |^^^^&^|||&^ 22 16 49 26 23 2 52 55 23 20 28 162 44 49 956 56 60 1 17 40 92 8 57 1 69 17 2 23 62 9 63 68 17 20 5 910 41 29 402 67 33 244 37 59 92 20 51 39 21 61 4078 10 47 153 32 49 1 10 55 3 40 17 3 50 7 30 13 46 56 20 1 0 3 26 0 69 60 67 66 59 169 21 63 1 11 34 3 44 68 2264 32 36 114 12 15...
output:
3071
result:
ok single line: '3071'
Test #98:
score: 0
Accepted
time: 2039ms
memory: 210636kb
input:
70 100 ^^^^^^^^^^^^ 66 46 24 45 21 3943 23 24 740 55 49 3954 39 47 84 35 63 142 9 69 4033 54 32 226 53 40 1262 6 36 1428 51 6 6 42 39 35 2 5 2211 65 63 1833 68 43 356 6 5 3 70 30 311 13 44 30 56 1 252 1 63 1301 26 62 2 5 50 51 41 54 117 56 21 247 61 61 37 63 23 18 23 46 1998 49 51 167 8 6 841 23 20 ...
output:
-1
result:
ok single line: '-1'
Test #99:
score: 0
Accepted
time: 2158ms
memory: 212816kb
input:
70 2000 ^^^^^|&|^^&^ 58 4 699 51 38 2008 16 38 113 60 36 117 21 63 296 45 60 535 59 41 0 44 68 361 40 56 869 25 36 23 48 9 483 52 53 99 17 52 7 70 66 93 13 15 215 67 49 103 66 48 361 23 3 394 66 33 31 17 13 107 48 36 45 27 41 52 43 58 205 13 47 382 40 66 1842 5 57 4006 56 30 1387 49 21 40 52 64 434 ...
output:
4031
result:
ok single line: '4031'
Test #100:
score: 0
Accepted
time: 1786ms
memory: 212812kb
input:
70 5000 &&&&&&&&&&&& 58 38 2875 70 26 1618 13 58 515 55 45 1901 46 44 3362 60 16 2543 9 21 865 60 26 934 56 53 537 41 50 1325 23 17 2701 12 7 3614 39 43 871 20 11 247 43 6 723 15 19 1972 56 64 2758 58 11 2338 69 26 1405 6 49 1128 67 26 4090 19 54 3251 68 20 2834 34 24 205 56 16 2519 48 9 2136 49 62 ...
output:
3840
result:
ok single line: '3840'
Test #101:
score: 0
Accepted
time: 1125ms
memory: 214856kb
input:
70 5000 &&&&&&&&&&&& 7 3 927 7 41 990 2 12 16 69 37 1456 27 26 82 64 17 25 42 36 13 54 22 31 50 11 4 4 37 78 14 43 621 3 67 0 41 49 0 1 1 1 64 15 39 19 25 204 8 59 8 68 45 3 48 37 23 67 38 13 66 30 3008 61 1 2 2 59 11 41 40 0 27 15 31 39 26 2 37 35 27 25 30 3 44 3 0 17 53 21 8 45 1637 53 69 407 57 6...
output:
2048
result:
ok single line: '2048'
Test #102:
score: 0
Accepted
time: 1228ms
memory: 212812kb
input:
70 5000 &&&&&&&&&&&& 48 30 9 37 67 49 36 5 247 38 25 3377 16 35 306 54 42 919 42 56 844 38 5 610 1 17 177 49 13 76 41 5 1378 3 11 221 32 48 21 58 45 2700 35 66 763 52 66 58 40 43 14 25 8 1155 60 65 30 26 8 1365 33 48 30 2 26 3315 60 19 345 17 44 17 24 30 339 66 62 1410 29 27 86 50 70 377 31 62 58 56...
output:
3072
result:
ok single line: '3072'
Test #103:
score: 0
Accepted
time: 1816ms
memory: 214852kb
input:
70 5000 |||||||||||| 4 60 3467 38 52 808 4 16 1187 59 31 597 34 9 342 35 5 2615 18 1 2590 43 56 2801 25 9 285 55 60 1363 13 65 1740 3 49 2450 64 27 2230 19 2 100 52 60 1264 17 37 2078 10 43 3602 34 5 2413 16 3 1360 51 43 4095 42 3 2170 37 30 3595 17 45 1424 41 38 3074 33 14 2898 26 24 1838 18 35 555...
output:
4095
result:
ok single line: '4095'
Test #104:
score: 0
Accepted
time: 2466ms
memory: 212812kb
input:
70 5000 |||||||||||| 22 45 1 70 10 31 65 53 1 41 60 10 4 5 58 19 8 0 7 63 0 63 9 2 22 38 23 56 47 53 31 5 13 33 13 16 43 38 0 36 27 60 40 46 3 8 6 21 11 28 13 33 27 42 16 9 22 30 30 1 55 11 11 66 30 3 57 12 52 2 4 25 43 36 21 57 4 59 7 23 59 33 1 32 62 17 33 32 15 48 65 59 54 16 20 14 68 44 9 1 26 6...
output:
2111
result:
ok single line: '2111'
Test #105:
score: 0
Accepted
time: 2291ms
memory: 212812kb
input:
70 5000 |||||||||||| 50 17 31 45 32 24 67 40 82 53 20 72 39 6 66 60 20 19 5 36 352 13 40 179 13 34 51 25 67 1177 7 33 461 35 52 0 15 29 1480 38 25 27 61 58 179 5 35 10 31 16 32 27 45 474 8 66 26 63 19 19 14 22 22 3 8 825 50 42 42 7 64 3619 56 63 326 18 65 866 63 9 53 13 56 128 59 54 151 58 34 109 61...
output:
4095
result:
ok single line: '4095'
Test #106:
score: 0
Accepted
time: 2577ms
memory: 212816kb
input:
70 5000 ^^^^^^^^^^^^ 64 30 2569 12 4 1022 50 62 1080 41 34 3788 61 33 2198 64 15 3817 34 41 522 5 35 3760 24 66 2526 6 25 3527 42 34 3715 6 11 3120 29 46 1419 53 34 2364 23 60 471 61 13 3879 30 45 1241 24 41 391 57 69 3196 22 10 2558 53 35 506 54 34 3296 36 43 1855 60 30 3686 41 5 2088 50 22 853 9 4...
output:
4095
result:
ok single line: '4095'
Test #107:
score: 0
Accepted
time: 2570ms
memory: 212812kb
input:
70 5000 ^^^^^^^^^^^^ 9 61 392 58 61 0 5 34 1 58 63 1 27 44 657 21 12 953 8 56 119 18 9 1 19 19 1462 4 47 698 26 18 43 12 58 25 6 10 14 33 61 12 13 23 1581 48 23 217 59 43 301 8 33 12 41 52 18 13 52 254 27 15 955 32 5 717 5 31 214 20 5 336 15 67 39 35 63 1148 21 53 0 58 7 907 58 7 1 1 20 121 64 27 48...
output:
4095
result:
ok single line: '4095'
Test #108:
score: 0
Accepted
time: 2574ms
memory: 212812kb
input:
70 5000 ^^^^^^^^^^^^ 3 57 4 55 28 69 50 30 6 21 32 69 24 41 66 29 33 70 28 46 68 24 67 65 33 64 70 6 32 67 4 33 66 23 45 65 30 33 70 50 38 3 64 3 2 55 23 65 16 29 3 1 4 0 38 59 65 69 70 4 70 51 66 8 30 70 14 67 4 25 53 1 15 56 70 57 7 65 14 49 69 68 1 70 33 43 5 30 56 7 24 47 68 34 44 4 54 16 3 53 3...
output:
71
result:
ok single line: '71'