QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#401195 | #5055. Tube Master III | hos_lyric | AC ✓ | 4ms | 4380kb | C++14 | 5.5kb | 2024-04-28 06:46:45 | 2024-04-28 06:46:53 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
/*
e[x][y] = [corner at (x, y)] (0 <= x <= M, 0 <= y <= N)
C[x][y] = \sum e[x, x+1][y, y+1] (0 <= x < M, 0 <= y < N)
D[x][y] := \sum c[x][y, y+1] (0 <= x <= M, 0 <= y < N)
C[x][y] = D[x][y] + D[x+1][y] (0 <= x < M)
\sum D[0, M][y] = \sum e[0, M][y] + \sum e[0, M][y+1] == 0 + 0 = 0 (mod 2)
D[x][y] mod 2: determined if M: even
(e[x][0], ..., e[x][N]): at most 2 ways
given e[x][*],
(e[x+1][y], e[x+1][y+1]) = (0, 0), (1, 1): distinguishable
bad case: (0,1, 0,1, ..., 0,1), (1,0, 1,0, ..., 1,0)
determined if there is tate-sen at 1 <= y <= N-1
2-taku for O(1) states
O(M) states finally
*/
constexpr Int INF = 1001001001001001001LL;
int M, N;
int C[110][110];
Int Yoko[110][110], Tate[110][110];
int D[110][110];
using INT = __int128;
bool can[110][2];
INT E[110][2];
INT jama[110][2];
Int cost[110][2];
bool adj[110][2][2];
int main() {
for (int numCases; ~scanf("%d", &numCases); ) { for (int caseId = 1; caseId <= numCases; ++caseId) {
scanf("%d%d", &M, &N);
if (M % 2 == 0) {
for (int x = 0; x < M; ++x) for (int y = 0; y < N; ++y) scanf("%d", &C[x][y]);
for (int x = 0; x <= M; ++x) for (int y = 0; y < N; ++y) scanf("%lld", &Yoko[x][y]);
for (int x = 0; x < M; ++x) for (int y = 0; y <= N; ++y) scanf("%lld", &Tate[x][y]);
} else if (N % 2 == 0) {
swap(M, N);
for (int y = 0; y < N; ++y) for (int x = 0; x < M; ++x) scanf("%d", &C[x][y]);
for (int y = 0; y <= N; ++y) for (int x = 0; x < M; ++x) scanf("%lld", &Tate[x][y]);
for (int y = 0; y < N; ++y) for (int x = 0; x <= M; ++x) scanf("%lld", &Yoko[x][y]);
} else {
assert(false);
}
/*
cerr<<COLOR("33");
cerr<<"C = "<<endl;for(int x=0;x<M;++x)pv(C[x],C[x]+N);
cerr<<"Yoko = "<<endl;for(int x=0;x<=M;++x)pv(Yoko[x],Yoko[x]+N);
cerr<<"Tate = "<<endl;for(int x=0;x<M;++x)pv(Tate[x],Tate[x]+(N+1));
cerr<<COLOR();
*/
for (int y = 0; y < N; ++y) {
D[0][y] = 0;
for (int x = 1; x < M; x += 2) D[0][y] ^= C[x][y];
D[0][y] &= 1;
for (int x = 0; x < M; ++x) D[x+1][y] = (C[x][y] ^ D[x][y]) & 1;
}
// cerr<<"D = "<<endl;for(int x=0;x<=M;++x)pv(D[x],D[x]+N);
for (int x = 0; x <= M; ++x) {
for (int s = 0; s < 2; ++s) {
E[x][s] = s;
jama[x][s] = 0;
cost[x][s] = 0;
int e = s;
int yokosen = e;
for (int y = 0; y < N; ++y) {
e ^= D[x][y];
E[x][s] |= (INT)e << (y+1);
if (yokosen && !e) jama[x][s] |= (INT)1 << (y+1);
if (yokosen) cost[x][s] += Yoko[x][y];
yokosen ^= e;
}
can[x][s] = !yokosen;
}
}
for (int x = 0; x < M; ++x) {
for (int s = 0; s < 2; ++s) for (int t = 0; t < 2; ++t) {
bool &ok = adj[x][s][t] = true;
ok = ok && can[x][s] && can[x+1][t];
for (int y = 0; y < N; ++y) {
int c = 0;
c += (E[x][s] >> y & 1);
c += (E[x][s] >> (y+1) & 1);
c += (E[x+1][t] >> y & 1);
c += (E[x+1][t] >> (y+1) & 1);
ok = ok && (C[x][y] == c);
}
}
}
// state: tate-sen set
map<INT, Int> crt[2];
for (int s = 0; s < 2; ++s) if (can[0][s]) {
crt[s][E[0][s]] = cost[0][s];
}
for (int x = 0; x < M; ++x) {
map<INT, Int> nxt[2];
for (int s = 0; s < 2; ++s) for (int t = 0; t < 2; ++t) if (adj[x][s][t]) {
for (const auto &kv : crt[s]) {
if (!(kv.first & jama[x+1][t])) {
const INT kk = kv.first ^ E[x+1][t];
Int co = kv.second;
for (int y = 0; y <= N; ++y) if (kv.first >> y & 1) co += Tate[x][y];
co += cost[x+1][t];
auto it = nxt[t].find(kk);
if (it != nxt[t].end()) {
chmin(it->second, co);
} else {
nxt[t][kk] = co;
}
}
}
}
for (int t = 0; t < 2; ++t) {
crt[t].swap(nxt[t]);
}
}
Int ans = INF;
for (int s = 0; s < 2; ++s) {
for (const auto &kv : crt[s]) {
if (!kv.first) {
chmin(ans, kv.second);
}
}
}
printf("%lld\n", (ans < INF) ? ans : -1);
}
#ifndef LOCAL
break;
#endif
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4124kb
input:
4 2 3 4 3 2 2 3 4 2 1 1 2 1 2 1 2 1 1 2 1 2 1 1 1 2 2 2 2 1 2 1 1 2 2 2 1 2 1 2 1 2 1 1 3 2 1 2 3 3 3 2 1 1 1 1 2 2 1 1 1 1 1 1 1 1 2 2 2 2 2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
output:
13 8 11 -1
result:
ok 4 number(s): "13 8 11 -1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
625 2 4 4 4 4 2 2 2 2 1 837217517 477808443 347130695 115514808 489553684 398759512 596840600 280503551 696860065 695918333 942896928 193399496 216232955 74284779 930393377 755505726 110017758 585487191 930827120 623433536 350909145 590245738 4 2 4 2 4 2 4 2 2 1 141009644 296725434 808814647 1837719...
output:
4247159333 3838923693 3990350380 7876781086 4607650830 0 8547398810 7019330724 1543131518 1745347993 7025331496 6468316538 8441980752 5900510976 7299857780 5529555721 9489994512 10245127941 6826365738 4793528215 3397770171 6314194241 7189286391 3675694662 7236121551 1085350428 4257155882 6250397609 ...
result:
ok 625 numbers
Test #3:
score: 0
Accepted
time: 2ms
memory: 4148kb
input:
100 9 10 2 3 3 3 2 1 2 1 0 1 3 3 3 3 1 2 4 2 1 3 2 2 2 1 1 3 4 3 3 4 3 3 3 2 3 3 2 2 3 4 3 3 3 3 3 3 1 0 1 2 2 3 2 1 1 2 2 2 2 2 1 3 2 1 1 1 3 3 3 4 0 2 3 3 3 2 3 3 3 4 2 3 4 4 3 2 2 3 3 3 2 2 2 1 2 2 1 2 2 1 1 2 1 2 1 1 1 2 1 2 1 1 1 2 1 1 2 2 2 1 2 2 1 1 1 2 1 2 1 1 1 2 2 1 2 1 2 2 2 2 2 2 2 1 2 1...
output:
145 83 92 68 33 128 55 65 116 123 89 88 28 124 57 112 34 10 75 100 80 133 47 122 141 124 55 84 10 113 59 17 72 133 142 83 35 64 132 37 31 81 138 109 88 31 46 89 139 61 83 86 131 108 57 114 127 76 49 30 43 44 52 73 26 34 52 133 86 81 17 138 64 37 152 74 63 111 79 63 71 54 60 19 115 37 118 56 89 103 7...
result:
ok 100 numbers
Test #4:
score: 0
Accepted
time: 2ms
memory: 3776kb
input:
100 10 10 1 0 1 1 0 2 4 2 0 0 2 0 2 2 1 2 2 1 0 1 2 0 1 2 3 2 0 0 0 2 2 1 1 2 3 2 2 2 1 1 2 2 3 2 2 3 4 4 3 1 2 1 3 2 2 4 3 2 2 1 3 1 1 2 2 3 2 1 2 1 2 2 2 3 2 2 3 3 3 1 2 3 4 4 2 2 3 3 3 1 2 2 2 3 2 1 2 3 4 2 656457797 910278956 559453213 519683646 563393775 660204393 706457950 975192562 542122903 ...
output:
42151363552 44244281206 23474314418 17305364388 14977938448 44350310401 17337960986 43534333196 26298210625 48053574070 43505759630 6113452273 29824635167 15503211658 15606686072 4158055561 8616212986 31994475848 13356485788 20886816695 34433755754 19237486220 49847589134 44601981857 10790944143 430...
result:
ok 100 numbers
Test #5:
score: 0
Accepted
time: 2ms
memory: 3856kb
input:
100 7 10 2 0 2 2 2 4 3 1 0 1 2 1 2 2 1 3 4 2 1 3 2 3 3 2 1 2 2 1 2 4 3 4 4 2 1 1 1 1 1 3 3 3 3 2 1 2 2 2 1 2 1 1 2 3 3 3 2 3 2 2 1 0 2 4 4 2 1 2 1 1 642991784 784060206 696590397 302747341 167946335 810779670 125019359 439957915 637658209 308970063 861462918 47629128 665397837 213361607 158711734 61...
output:
33888844270 22277234362 43538727528 12477996110 7989356770 42711334985 29940113008 30157009226 27509659716 34513173419 18135001117 48307760510 17669750254 31059918263 34209422155 28842796322 31873678367 30760514538 21380213644 13775863494 14906075170 56336567247 28935870939 33391001117 34498691235 4...
result:
ok 100 numbers
Test #6:
score: 0
Accepted
time: 2ms
memory: 3880kb
input:
20 10 18 1 2 2 2 2 1 1 1 2 3 2 3 3 2 1 1 1 1 1 2 2 3 3 2 3 2 2 3 3 4 3 2 2 3 3 3 0 1 2 3 4 4 3 1 2 4 3 3 3 2 2 2 2 2 1 3 4 4 4 3 2 2 3 4 2 2 4 3 2 1 0 0 2 3 4 3 2 2 2 3 4 4 3 3 4 2 2 3 2 2 1 1 3 3 1 2 3 2 3 4 3 2 2 1 1 2 2 2 0 0 1 3 2 1 3 2 1 2 1 0 0 0 1 2 2 2 0 1 2 3 2 1 3 3 2 2 1 1 1 1 2 2 3 4 1 2...
output:
82205785875 142848175588 125003500323 67643486362 156458395061 33539018056 126860540940 21517885567 92012642508 54473464255 91488072333 110191033025 112622824354 169721058221 76262819390 117757749678 169995729286 10926386840 50515884740 26295484624
result:
ok 20 numbers
Test #7:
score: 0
Accepted
time: 2ms
memory: 3884kb
input:
20 14 20 1 2 4 2 1 1 1 2 2 3 4 3 3 2 0 2 3 3 3 1 1 2 4 3 3 3 3 3 3 3 3 3 2 1 0 1 2 3 3 1 1 1 2 3 4 3 3 3 2 2 3 3 1 0 0 1 2 3 3 2 1 2 2 3 3 2 3 3 2 3 4 4 2 1 2 3 4 4 3 3 3 4 4 4 3 2 3 4 4 3 3 3 1 2 4 4 4 3 3 4 4 3 2 3 3 2 2 3 3 2 2 2 1 1 3 3 2 2 2 3 2 2 2 3 2 2 2 1 2 3 2 2 3 2 3 3 2 3 2 2 2 2 3 4 3 3...
output:
131586761750 79277689220 172842234356 85645340631 162733176961 138048933422 159104373896 47397497135 86573626993 165432300791 73665374368 41085256216 32846283438 86623592503 69783956388 171354791439 71663150129 141889530462 157796597383 74927481746
result:
ok 20 numbers
Test #8:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
4 50 24 3 2 2 3 4 2 1 3 2 2 3 3 2 0 2 2 0 1 2 3 2 1 3 4 3 3 2 3 4 2 1 3 2 1 2 3 2 1 2 2 2 2 3 3 2 2 2 2 3 4 3 3 4 3 2 3 2 0 1 3 2 1 2 3 4 3 2 1 2 3 1 0 2 2 1 2 3 3 2 2 2 0 0 1 2 2 3 4 4 2 0 0 2 2 1 1 1 2 1 1 1 2 2 2 3 1 1 1 2 3 3 4 4 2 0 1 3 2 1 1 2 2 2 2 1 2 3 3 3 1 1 1 2 3 3 3 3 3 2 3 4 3 2 1 2 1 ...
output:
538981563569 739580284018 487964318362 179323332306
result:
ok 4 number(s): "538981563569 739580284018 487964318362 179323332306"
Test #9:
score: 0
Accepted
time: 2ms
memory: 3984kb
input:
4 42 43 3 3 2 3 3 1 2 3 2 3 2 0 1 2 2 3 3 1 0 1 3 3 2 3 2 0 1 3 2 2 4 2 2 2 1 3 3 3 4 3 1 2 3 2 4 3 2 2 2 2 2 2 3 2 1 3 4 4 4 4 2 0 1 3 3 2 2 2 1 2 3 1 1 3 2 2 3 2 2 3 3 3 4 2 2 3 3 3 2 1 2 4 2 1 3 4 2 2 3 3 3 3 3 2 2 2 3 3 3 2 1 1 2 2 1 1 1 2 3 3 2 2 3 3 3 3 2 3 3 3 1 2 3 3 4 3 2 2 2 2 2 1 2 3 2 1 ...
output:
734929485585 926603281187 703633326451 628923420350
result:
ok 4 number(s): "734929485585 926603281187 703633326451 628923420350"
Test #10:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
1 24 27 3 3 3 3 2 1 0 0 1 1 0 1 2 2 2 2 3 3 3 2 1 3 3 2 3 2 2 2 3 4 2 2 2 0 0 2 2 0 1 3 3 3 4 3 2 2 2 3 4 4 3 2 2 2 0 1 3 3 3 2 0 1 3 2 0 2 3 2 3 3 2 2 2 3 3 2 3 3 2 2 1 1 0 2 4 4 3 2 2 2 2 2 3 2 1 3 2 2 4 4 3 2 1 2 2 2 2 0 1 0 1 2 3 4 3 1 0 2 4 4 2 0 2 2 1 3 4 2 2 3 3 3 2 1 0 0 1 2 1 2 4 2 0 1 3 3 ...
output:
275980450654
result:
ok 1 number(s): "275980450654"
Test #11:
score: 0
Accepted
time: 3ms
memory: 4084kb
input:
1 84 97 2 1 3 4 2 1 2 1 2 2 2 3 3 2 0 2 4 3 3 2 0 1 3 4 4 2 0 1 3 4 3 3 4 2 2 3 3 4 2 0 2 3 1 1 3 4 3 1 1 2 2 2 1 1 1 0 0 0 1 3 3 2 1 2 2 0 0 2 3 2 1 2 4 4 4 3 2 2 3 3 2 1 1 3 4 4 4 3 2 1 1 2 2 2 2 2 1 2 3 3 3 3 3 4 3 3 2 1 3 3 2 1 1 2 1 1 1 1 3 4 3 2 1 1 3 4 4 4 3 2 2 3 4 4 3 1 0 1 1 0 2 4 3 2 2 3 ...
output:
3346010724715
result:
ok 1 number(s): "3346010724715"
Test #12:
score: 0
Accepted
time: 2ms
memory: 4084kb
input:
1 96 58 3 3 2 3 3 1 1 2 3 4 2 0 0 0 0 1 3 3 1 1 2 3 2 2 4 3 1 1 3 2 0 1 2 3 4 2 2 2 0 2 4 2 1 1 0 1 1 1 2 3 4 2 0 1 3 3 2 2 3 3 4 3 3 2 0 1 2 3 3 1 1 1 0 2 4 4 3 2 3 4 2 1 2 2 2 3 3 2 2 2 2 2 2 1 2 3 2 3 3 2 3 2 1 2 2 3 3 2 3 3 1 1 2 2 1 0 3 2 2 1 1 1 1 3 3 3 4 3 2 2 2 3 4 3 3 3 3 4 3 1 0 2 4 4 2 2 ...
output:
2354793399279
result:
ok 1 number(s): "2354793399279"
Test #13:
score: 0
Accepted
time: 2ms
memory: 4012kb
input:
1 78 95 2 2 3 2 2 3 2 3 3 1 0 0 1 1 0 0 2 4 4 3 3 4 3 1 1 2 1 1 2 2 2 2 3 3 1 1 3 4 2 1 2 3 4 2 0 0 2 3 3 4 3 2 2 1 2 3 2 2 3 2 1 1 2 2 0 1 2 2 1 2 3 2 3 4 2 1 3 4 3 2 3 2 1 2 1 0 2 3 3 2 0 0 0 2 3 2 4 3 1 2 3 2 2 3 3 2 1 2 2 1 1 1 3 3 3 4 4 4 2 2 4 3 3 3 3 3 3 3 2 1 2 3 3 3 3 4 4 3 2 1 0 2 2 1 2 1 ...
output:
3043468939252
result:
ok 1 number(s): "3043468939252"
Test #14:
score: 0
Accepted
time: 3ms
memory: 4080kb
input:
1 100 83 2 1 2 4 4 2 0 0 0 1 2 1 2 4 4 3 2 1 2 2 0 1 2 1 0 1 3 3 2 2 2 1 0 0 2 3 3 3 2 3 2 1 2 2 1 1 2 3 2 0 2 2 2 3 2 1 2 4 3 2 3 3 2 3 4 3 1 1 3 3 1 2 2 1 2 2 3 2 0 0 2 3 1 2 3 3 4 3 1 1 2 2 2 2 1 1 3 3 2 3 3 3 3 1 2 4 3 1 1 3 4 3 2 2 1 0 1 3 4 3 2 3 3 2 1 1 2 2 2 2 2 1 0 2 2 1 3 3 2 2 2 2 1 1 3 3...
output:
3365918945244
result:
ok 1 number(s): "3365918945244"
Test #15:
score: 0
Accepted
time: 2ms
memory: 4032kb
input:
1 82 97 3 1 0 1 3 2 0 2 2 2 4 3 2 1 2 4 2 1 1 2 3 2 1 1 1 2 4 4 4 3 2 3 4 4 4 3 3 3 2 2 3 3 2 1 2 4 2 0 2 4 2 2 3 3 3 2 2 2 3 4 2 1 2 1 1 3 4 2 2 4 3 3 4 3 2 2 3 4 3 2 3 3 1 2 3 2 2 3 4 4 4 4 2 2 3 1 1 2 1 0 1 2 2 2 2 2 3 4 4 4 2 1 2 1 2 3 2 1 2 3 2 2 3 4 4 3 2 3 4 4 4 4 4 4 3 3 4 4 4 2 1 2 2 1 0 2 ...
output:
3258346225260
result:
ok 1 number(s): "3258346225260"
Test #16:
score: 0
Accepted
time: 2ms
memory: 4372kb
input:
1 92 63 3 4 4 3 2 2 2 2 2 2 1 2 2 0 1 1 1 3 4 4 3 2 2 3 4 3 1 2 2 2 2 1 1 1 3 2 2 3 3 4 4 2 1 2 2 2 2 1 2 2 1 1 0 2 2 2 2 1 1 1 1 1 3 2 2 2 2 3 4 3 2 2 3 3 2 2 1 1 1 0 1 3 4 4 3 1 2 4 4 3 3 2 1 2 2 2 2 2 1 2 3 2 2 2 1 2 4 4 3 2 1 2 2 1 2 1 1 2 2 1 2 2 2 3 3 3 1 0 1 2 3 4 3 2 3 4 4 2 2 2 2 2 1 2 3 4 ...
output:
2350596119419
result:
ok 1 number(s): "2350596119419"
Test #17:
score: 0
Accepted
time: 0ms
memory: 4364kb
input:
1 96 68 4 4 3 2 2 3 3 3 3 3 4 4 4 3 1 1 2 2 1 1 3 4 3 2 2 1 2 4 4 2 0 2 3 1 0 0 0 2 4 4 2 0 1 3 4 2 0 2 2 1 2 2 1 2 2 2 2 0 1 2 3 2 1 1 1 2 1 1 3 4 4 4 4 3 3 4 4 4 3 3 4 3 1 0 0 1 1 2 3 2 2 3 4 2 1 2 2 2 2 3 4 3 2 1 0 2 4 3 1 0 1 3 3 1 1 2 2 2 2 3 2 2 3 2 2 1 2 4 3 1 2 2 1 1 1 2 3 4 3 2 2 1 1 3 4 4 ...
output:
2669648218440
result:
ok 1 number(s): "2669648218440"
Test #18:
score: 0
Accepted
time: 3ms
memory: 4028kb
input:
1 98 100 4 3 2 3 3 2 3 3 1 1 2 1 1 1 0 0 2 3 3 3 1 1 1 2 3 3 2 1 2 2 3 2 0 0 1 2 1 2 3 3 2 0 2 2 0 2 4 2 0 1 3 2 1 3 3 2 2 3 4 2 1 2 2 1 1 1 0 0 2 3 1 2 2 2 3 3 2 0 1 1 1 1 1 1 2 3 2 3 2 0 2 4 3 3 3 1 1 3 2 1 3 2 3 4 2 1 3 3 2 3 3 1 1 2 2 2 2 3 4 3 2 3 3 3 4 3 2 2 3 3 3 3 2 2 2 3 3 2 2 2 1 1 2 2 2 3...
output:
4071885940196
result:
ok 1 number(s): "4071885940196"
Test #19:
score: 0
Accepted
time: 2ms
memory: 4104kb
input:
1 96 75 3 3 4 2 2 3 2 2 3 3 2 2 3 4 2 1 2 1 2 2 1 2 3 3 2 2 2 1 1 3 3 1 1 1 1 2 1 2 3 2 1 1 2 3 2 2 2 0 1 2 3 2 1 3 3 3 4 3 1 1 1 1 1 2 4 3 2 1 2 4 3 1 2 4 2 2 3 4 2 2 4 3 3 3 2 3 3 2 3 3 3 4 2 1 2 3 3 2 2 3 4 3 1 2 3 2 2 3 3 3 3 1 1 3 4 2 2 4 4 2 1 2 1 2 4 4 3 3 3 2 2 2 2 1 2 2 2 2 2 3 3 4 2 2 3 1 ...
output:
2970728844094
result:
ok 1 number(s): "2970728844094"
Test #20:
score: 0
Accepted
time: 3ms
memory: 3888kb
input:
625 2 4 4 4 4 2 2 2 2 1 708006908 837217517 477808443 347130695 115514808 489553684 398759512 596840600 280503551 696860065 695918333 942896928 193399496 216232955 74284779 930393377 755505726 110017758 585487191 930827120 623433536 350909145 1 4 2 2 2 0 454104037 194101882 139781095 76346803 321229...
output:
3114400278 2807251711 7030143807 6674325926 2721896177 9465500605 10126437590 3777765132 10108299869 5120985902 5270167442 6488185828 7427096657 6772400239 9328567174 1329571840 8907755181 4704363939 8774493244 7671753619 7723112821 5323941899 6042850836 1532424099 8310571906 13064532655 6321654967 ...
result:
ok 625 numbers
Test #21:
score: 0
Accepted
time: 2ms
memory: 4152kb
input:
100 9 10 2 3 3 3 2 1 2 1 0 1 3 3 3 3 1 2 4 2 1 3 2 2 2 1 1 3 4 3 3 4 3 3 3 2 3 3 2 2 3 4 3 3 3 3 3 3 1 0 1 2 2 3 2 1 1 2 2 2 2 2 1 3 2 1 1 1 3 3 3 4 0 2 3 3 3 2 3 3 3 4 2 3 4 4 3 2 2 3 3 3 2 1 1 2 1 2 1 2 2 2 1 1 2 1 1 1 1 1 2 2 2 1 2 2 2 1 2 1 2 2 2 2 1 1 1 1 2 1 1 2 2 2 2 2 1 1 2 1 1 2 2 2 1 1 1 2...
output:
133 79 49 54 88 32 77 70 101 34 44 45 49 49 34 -1 46 30 91 114 -1 121 112 94 74 116 -1 -1 82 60 92 153 49 53 137 106 46 76 -1 124 117 31 72 67 116 85 38 65 -1 136 107 23 57 110 -1 101 48 71 97 57 64 68 29 -1 56 21 37 139 81 21 61 58 129 94 -1 93 76 9 102 48 46 28 57 124 58 -1 -1 33 -1 -1 80 74 44 -1...
result:
ok 100 numbers
Test #22:
score: 0
Accepted
time: 2ms
memory: 3848kb
input:
100 10 10 1 0 1 1 0 2 4 2 0 0 2 0 2 2 1 2 2 1 0 1 2 0 1 2 3 2 0 0 0 2 2 1 1 2 3 2 2 2 1 1 2 2 3 2 2 3 4 4 3 1 2 1 3 2 2 4 3 2 2 1 3 1 1 2 2 3 2 1 2 1 2 2 2 3 2 2 3 3 3 1 2 3 4 4 2 2 3 3 3 1 2 2 2 3 2 1 2 3 4 2 480634013 411446639 330062457 986598580 475770613 561641499 837003792 114859738 880193610 ...
output:
42887007558 14289921635 11075701092 -1 51726049434 19708269470 25803716456 37950908154 15682285521 21991111692 31090931518 5991053996 -1 -1 24254258227 44614660967 13636208217 33532746126 36556953905 26921277039 -1 36500301280 38523203763 -1 -1 -1 13822268984 9411726448 26539935104 20216295101 -1 -1...
result:
ok 100 numbers
Test #23:
score: 0
Accepted
time: 3ms
memory: 3792kb
input:
100 7 10 2 0 2 2 2 4 3 1 0 1 2 1 2 2 1 3 4 2 1 3 2 3 3 2 1 2 2 1 2 4 3 4 4 2 1 1 1 1 1 3 3 3 3 2 1 2 2 2 1 2 1 1 2 3 3 3 2 3 2 2 1 0 2 4 4 2 1 2 1 1 625422709 523113976 542932359 933716710 277880017 147054453 960847753 335733787 446152008 197925760 990380030 430161561 777958950 151903733 544198202 4...
output:
33072359425 25567622752 -1 27917146761 33570309923 37571504397 9970666604 21891456533 44096483941 17123656498 45140205386 45816989474 40792433674 19361333450 21487455189 -1 -1 37509496740 31341041139 26255627815 46901840676 23401580679 11895371492 34702873987 44840247148 -1 25887845934 30082583595 -...
result:
ok 100 numbers
Test #24:
score: 0
Accepted
time: 2ms
memory: 4164kb
input:
20 10 18 1 2 2 2 3 3 2 1 2 3 2 3 3 2 1 1 1 1 1 2 2 3 3 2 3 2 2 3 3 4 3 2 2 3 3 3 0 1 2 3 3 2 2 1 2 4 3 3 3 2 2 2 2 2 1 3 4 4 4 3 2 2 3 4 2 2 4 3 2 1 0 0 2 3 4 3 2 2 2 3 4 4 3 3 4 2 2 3 2 2 1 1 3 3 1 2 3 2 3 4 3 2 2 1 1 2 2 2 0 0 1 3 2 1 3 2 1 2 1 0 0 0 1 2 2 2 0 1 2 3 2 1 3 3 2 2 1 1 1 1 2 2 3 4 1 2...
output:
-1 -1 40562542979 -1 -1 35675788645 -1 -1 58098438501 -1 -1 -1 -1 -1 77469799369 -1 -1 -1 19043320112 -1
result:
ok 20 numbers
Test #25:
score: 0
Accepted
time: 2ms
memory: 3936kb
input:
20 14 20 1 2 4 2 1 1 1 2 2 3 4 3 3 2 0 2 3 2 3 2 1 2 4 3 3 3 3 3 3 3 3 3 2 1 0 1 2 1 2 3 1 1 2 3 4 3 3 3 2 2 3 3 1 0 0 0 1 2 2 2 1 2 2 3 3 2 3 3 2 3 4 4 2 1 2 1 2 4 2 1 3 4 4 4 3 2 3 4 4 3 3 3 1 2 4 3 3 3 2 3 4 3 2 3 3 2 2 3 3 2 2 2 1 1 3 3 2 2 2 3 2 2 2 3 2 2 2 1 2 3 3 2 2 2 3 3 2 3 2 2 2 2 3 4 3 3...
output:
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 35287150840 -1 142389194754 -1 32088317539 -1 -1 106618206404 -1
result:
ok 20 numbers
Test #26:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
625 2 4 4 4 4 2 2 2 2 1 477808443 347130695 115514808 489553684 398759512 596840600 280503551 696860065 695918333 942896928 193399496 216232955 74284779 930393377 755505726 110017758 585487191 930827120 623433536 350909145 590245738 84343798 2 3 2 1 0 4 2 1 216858056 211442646 945679991 185037306 26...
output:
3142787954 -1 4935746640 11379091474 -1 -1 8729720213 9955301770 5971664327 -1 1775020178 4752336453 3308140051 6785379916 8480682630 4901616049 9803831995 -1 -1 8378317209 -1 -1 9878000307 4971055543 1585429907 6452931416 -1 8392628903 -1 3256806980 -1 6727568950 8536298956 0 -1 8132855886 -1 78331...
result:
ok 625 numbers
Test #27:
score: 0
Accepted
time: 0ms
memory: 4144kb
input:
100 9 10 2 3 3 3 2 1 2 1 0 1 3 3 3 2 1 2 4 2 1 3 2 2 2 1 1 3 4 3 3 4 3 3 3 2 3 3 2 2 3 4 3 3 3 3 3 3 1 0 1 2 2 3 2 1 1 2 2 2 2 2 1 3 2 1 1 1 3 3 3 4 0 2 3 3 3 2 3 3 3 4 2 3 4 4 3 2 2 3 3 3 2 2 1 2 2 1 1 2 1 2 1 1 1 2 1 2 1 1 1 2 1 1 2 2 2 1 2 2 1 1 1 2 1 2 1 1 1 2 2 1 2 1 2 2 2 2 2 2 2 1 2 1 1 2 2 2...
output:
-1 -1 119 -1 123 -1 33 -1 -1 55 69 40 58 101 20 -1 88 120 -1 -1 -1 -1 26 -1 -1 85 -1 -1 95 105 -1 67 143 -1 52 27 -1 66 55 -1 59 -1 -1 -1 131 9 -1 -1 -1 -1 80 119 154 126 -1 89 45 -1 100 35 99 34 72 -1 -1 82 -1 -1 92 83 -1 86 120 -1 97 32 36 18 77 133 55 -1 35 -1 -1 -1 143 129 -1 26 -1 91 -1 111 -1 ...
result:
ok 100 numbers
Test #28:
score: 0
Accepted
time: 2ms
memory: 3844kb
input:
100 10 10 1 0 1 1 0 2 4 2 0 0 2 0 2 2 1 2 2 1 0 1 2 0 1 2 3 2 0 0 0 2 2 1 1 2 3 2 2 2 1 1 2 2 3 2 2 3 4 4 3 1 2 1 3 2 2 4 3 2 2 1 3 1 1 2 2 3 2 1 2 1 2 2 2 3 2 2 3 3 3 1 2 3 4 4 2 2 3 3 3 1 2 2 2 3 2 1 2 3 4 2 910278956 559453213 519683646 563393775 660204393 706457950 975192562 542122903 188426375 ...
output:
43111942156 49365075396 -1 -1 19614434520 42730452663 19666082549 42166249352 18324310187 28199625013 -1 36561985190 12935809156 19102301225 -1 -1 27728150976 24182478034 18386304832 41505029163 -1 -1 -1 11509727921 38455260281 -1 32169090136 25700704510 -1 13765129152 -1 13576618364 37295383855 -1 ...
result:
ok 100 numbers
Test #29:
score: 0
Accepted
time: 3ms
memory: 3860kb
input:
100 7 10 2 0 2 2 2 4 3 1 0 1 2 1 2 2 1 3 4 2 1 3 2 3 3 2 1 2 0 1 2 4 3 4 4 2 1 1 1 1 1 3 3 3 3 2 1 2 2 2 1 2 1 1 2 3 3 3 2 3 2 2 1 0 2 4 4 2 1 2 1 1 167946335 810779670 125019359 439957915 637658209 308970063 861462918 47629128 665397837 213361607 158711734 616261493 534210984 693270767 967103251 33...
output:
-1 24188979021 30242891972 23565711983 -1 -1 15826335539 35287405425 -1 33561019201 12988277931 8771947450 43886161789 16829330735 -1 -1 -1 36264641107 -1 -1 -1 34113527840 28275461555 -1 -1 28358737831 11303266952 24789060784 -1 26595727487 38840108887 43053855188 29342651839 -1 -1 -1 -1 3394660289...
result:
ok 100 numbers
Test #30:
score: 0
Accepted
time: 2ms
memory: 4136kb
input:
20 10 18 1 2 2 2 2 1 1 1 2 3 2 3 3 2 1 1 1 1 1 2 2 3 3 2 3 2 2 3 3 4 3 2 2 3 3 3 0 1 2 3 4 4 3 1 2 4 3 3 3 2 2 2 2 2 1 3 4 4 4 3 2 2 3 4 2 2 4 3 2 1 0 0 2 3 4 3 2 2 2 3 4 4 3 3 4 2 2 3 2 2 1 1 3 3 1 2 3 2 3 4 3 2 2 1 1 2 2 2 0 0 1 3 2 1 3 2 1 2 1 0 0 0 1 2 2 2 0 1 2 3 2 1 3 3 2 2 1 1 1 1 2 2 3 4 1 2...
output:
80088174800 -1 51508603131 -1 132130736375 -1 -1 97735394796 22110392313 34352032027 110536664836 177013577072 -1 85092300289 148575541766 42722192153 -1 -1 116806339608 42503996739
result:
ok 20 numbers
Test #31:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
20 14 20 1 2 4 2 1 1 1 2 2 3 4 3 3 2 0 2 3 3 3 1 1 2 4 3 3 3 3 3 3 3 3 3 2 1 0 1 2 3 3 1 1 1 2 3 4 3 3 3 2 2 3 3 1 0 0 1 2 3 3 2 1 2 2 3 3 2 3 3 2 3 4 4 2 1 2 3 4 4 3 3 3 4 4 4 3 2 3 4 4 3 3 3 1 2 4 4 4 3 3 4 4 3 2 3 3 2 2 3 3 2 2 2 1 1 3 3 2 2 1 3 2 2 2 3 2 2 2 1 2 3 2 2 3 2 3 3 2 3 2 2 2 2 3 4 3 3...
output:
-1 -1 123569157697 -1 -1 -1 -1 162379681174 -1 -1 156282531728 56734486285 82559229567 -1 141367941994 80397400135 105611850312 -1 -1 31824393659
result:
ok 20 numbers
Test #32:
score: 0
Accepted
time: 0ms
memory: 3840kb
input:
625 4 3 3 4 3 3 2 3 2 0 2 2 0 2 638227746 789623767 492461381 400802596 801487282 950736345 787423277 401634382 905232046 788034252 777119332 403277355 817362173 257489083 989697060 716970855 464027979 117741847 598460842 313460822 249669254 342750005 226976694 921061742 737643106 625422539 51035342...
output:
9792534372 8058196019 5120602208 6840403157 4528987531 3940395312 6761397736 9303437032 7084729118 4728649199 3518277867 6022115152 5741014950 9048032586 8736037645 4495099174 5438761162 4460116658 5522854630 6182837638 9330594061 4351555721 2495948096 3544435042 3139428016 5880246127 5158676134 170...
result:
ok 625 numbers
Test #33:
score: 0
Accepted
time: 2ms
memory: 3856kb
input:
100 9 10 2 3 3 3 2 1 2 1 0 1 3 3 3 3 1 2 4 2 1 3 2 2 2 1 1 3 4 3 3 4 3 3 3 2 3 3 2 2 3 4 3 3 3 3 3 3 1 0 1 2 2 3 2 1 1 2 2 2 2 2 1 3 2 1 1 1 3 3 3 4 0 2 3 3 3 2 3 3 3 4 2 3 4 4 3 2 2 3 3 3 2 2 2 1 2 2 1 2 2 1 1 2 1 2 1 1 1 2 1 2 1 1 1 2 1 1 2 2 2 1 2 2 1 1 1 2 1 2 1 1 1 2 2 1 2 1 2 2 2 2 2 2 2 1 2 1...
output:
145 29 87 50 82 93 137 108 117 36 62 9 66 106 43 65 66 79 41 76 64 109 65 109 123 10 88 58 98 60 51 39 74 111 119 104 83 132 26 39 44 26 115 94 52 17 52 91 83 110 115 52 120 124 144 48 16 45 103 75 76 106 60 43 62 109 79 71 65 81 105 147 41 56 125 38 80 63 56 80 78 86 89 24 67 39 67 120 91 65 44 48 ...
result:
ok 100 numbers
Test #34:
score: 0
Accepted
time: 2ms
memory: 3848kb
input:
100 10 9 1 1 1 2 4 3 2 3 4 2 2 2 1 2 2 3 3 3 2 1 1 0 1 2 2 1 2 2 0 0 1 3 3 1 1 2 3 1 1 3 3 2 2 3 3 3 2 2 4 2 2 3 3 4 3 3 3 3 2 3 3 3 3 4 4 4 2 2 4 3 3 3 3 3 3 2 2 4 2 2 4 3 2 2 3 3 4 2 1 2 530123649 703144951 750280808 152601573 504707274 682101578 517846076 66615190 668353404 811217360 218223521 43...
output:
40157839041 14139088660 16684630828 39641579767 28783707380 34006752162 44956990104 33232876019 34307498976 27357330463 41241724350 21449028217 25559289976 28409184964 24407397456 41674114514 16842697964 27273384693 45775214183 29784722870 28532411442 40960031041 44480049565 33121698983 25609462269 ...
result:
ok 100 numbers
Test #35:
score: 0
Accepted
time: 2ms
memory: 3928kb
input:
100 7 10 2 0 2 2 2 4 3 1 0 1 2 1 2 2 1 3 4 2 1 3 2 3 3 2 1 2 2 1 2 4 3 4 4 2 1 1 1 1 1 3 3 3 3 2 1 2 2 2 1 2 1 1 2 3 3 3 2 3 2 2 1 0 2 4 4 2 1 2 1 1 642991784 784060206 696590397 302747341 167946335 810779670 125019359 439957915 637658209 308970063 861462918 47629128 665397837 213361607 158711734 61...
output:
33888844270 31146137337 28018063351 43248904564 17422248032 14711551654 44039730906 29643704616 32229894992 45557943434 28347500425 46128630556 35070462412 36866283030 34722720733 48024717308 29343400875 33746632746 18319577882 16018800340 29197257251 35628715416 42305659558 46282532166 44468038418 ...
result:
ok 100 numbers
Test #36:
score: 0
Accepted
time: 2ms
memory: 3840kb
input:
20 19 18 2 1 2 2 2 2 2 3 3 1 0 0 0 1 2 2 2 2 1 2 4 3 2 2 3 4 3 2 2 1 1 3 2 1 2 1 1 2 3 2 1 3 3 3 2 2 4 2 1 2 2 3 4 3 1 1 2 3 1 2 2 2 2 1 2 1 0 1 2 3 4 4 2 2 3 3 1 1 1 2 3 1 1 2 2 3 2 1 3 4 2 3 4 2 1 1 1 2 2 1 1 2 2 2 2 1 2 3 1 1 3 2 2 3 2 1 0 0 1 2 2 2 3 3 2 1 2 1 3 2 2 3 1 0 1 2 2 2 3 4 4 4 2 0 1 2...
output:
141834088882 127014194375 135479459631 70891924575 25453553163 99126657935 46855382826 105036817136 32619398479 136263788908 101446185082 136985507629 157202274492 126244458369 95166515945 39515136121 15414809591 47826626938 106941920380 117806463357
result:
ok 20 numbers
Test #37:
score: 0
Accepted
time: 2ms
memory: 4188kb
input:
20 11 20 4 4 3 1 2 3 1 0 0 0 2 4 2 0 1 2 3 2 2 2 3 3 4 2 2 3 1 0 1 2 3 3 2 1 1 2 2 1 2 3 2 3 4 3 2 2 2 1 1 2 2 2 3 3 3 4 2 0 2 3 3 3 3 4 2 1 3 2 1 1 0 2 4 3 2 2 2 1 2 2 3 2 1 2 2 2 2 2 2 2 2 3 4 2 1 2 3 2 2 2 1 2 1 0 2 3 2 3 2 2 4 4 3 2 2 3 4 3 3 2 2 3 2 1 3 3 3 4 3 3 4 4 2 2 3 3 4 3 3 3 4 3 1 1 2 3...
output:
100769689333 75122176125 75967608036 157785788050 144359397672 135950410706 134716732947 141732285047 62791715605 53674424233 76369966482 54153867455 72740148917 170049200668 171658194658 113456929516 126710076162 47969865877 127135091442 77573806481
result:
ok 20 numbers
Test #38:
score: 0
Accepted
time: 2ms
memory: 4244kb
input:
4 48 35 3 4 4 2 1 2 1 2 4 3 1 1 3 3 2 2 1 1 1 2 4 3 3 4 2 1 2 3 3 1 0 1 3 2 2 3 4 3 1 1 2 2 2 2 2 1 1 2 3 4 2 0 1 1 2 4 3 3 3 2 1 2 4 4 2 1 3 3 1 2 1 3 2 0 2 4 4 2 0 2 2 1 1 1 2 2 2 2 2 3 4 4 4 3 2 1 1 2 2 1 2 3 2 1 1 0 1 1 1 3 4 3 1 1 2 2 2 2 1 1 3 4 2 2 4 3 3 3 2 2 2 1 0 1 2 3 3 3 3 1 0 0 0 2 4 3 ...
output:
718989917325 758511322699 139270616057 496413884251
result:
ok 4 number(s): "718989917325 758511322699 139270616057 496413884251"
Test #39:
score: 0
Accepted
time: 2ms
memory: 3952kb
input:
4 42 43 3 3 2 3 3 1 2 3 2 3 2 0 1 2 2 3 3 1 0 1 3 3 2 3 2 0 1 3 2 2 4 2 2 2 1 3 3 3 4 3 1 2 3 2 4 3 2 2 2 2 2 2 3 2 1 3 4 4 4 4 2 0 1 3 3 2 2 2 1 2 3 1 1 3 2 2 3 2 2 3 3 3 4 2 2 3 3 3 2 1 2 4 2 1 3 4 2 2 3 3 3 3 3 2 2 2 3 3 3 2 1 1 2 2 1 1 1 2 3 3 2 2 3 3 3 3 2 3 3 3 1 2 3 3 4 3 2 2 2 2 2 1 2 3 2 1 ...
output:
734929485585 926603281187 657334145397 851060760156
result:
ok 4 number(s): "734929485585 926603281187 657334145397 851060760156"
Test #40:
score: 0
Accepted
time: 2ms
memory: 4032kb
input:
1 76 67 2 3 4 4 3 2 2 2 3 3 3 4 2 0 1 3 3 1 1 1 2 3 1 0 0 2 4 3 2 1 1 1 1 2 3 4 2 0 2 3 3 3 3 4 4 3 3 4 3 2 3 4 2 0 1 3 3 1 2 4 4 3 2 1 1 2 2 1 3 3 2 3 4 3 3 3 2 2 3 2 1 3 4 3 2 3 2 1 2 1 1 2 2 2 2 3 2 2 3 3 4 3 3 2 1 2 2 2 3 3 3 3 3 3 3 4 4 3 2 1 0 2 3 3 2 1 2 3 3 1 0 0 1 2 1 3 3 2 2 3 4 3 2 3 2 2 ...
output:
2075758867321
result:
ok 1 number(s): "2075758867321"
Test #41:
score: 0
Accepted
time: 3ms
memory: 4380kb
input:
1 89 94 3 3 2 3 2 2 2 2 4 3 2 1 1 1 2 4 3 1 1 3 3 1 1 2 3 2 1 3 3 3 4 3 1 2 2 2 4 3 3 3 1 2 2 0 2 3 3 3 1 0 2 2 0 2 2 0 2 2 2 4 3 2 3 3 2 3 4 3 2 1 0 2 3 3 3 2 3 3 2 1 2 4 4 4 3 1 0 0 0 2 3 3 4 3 2 3 4 4 3 2 2 2 2 2 2 1 2 2 1 2 2 1 2 3 3 3 3 2 2 3 3 4 3 2 2 2 2 3 2 2 4 4 4 3 1 1 2 1 1 3 4 4 2 0 1 2 ...
output:
3398259319004
result:
ok 1 number(s): "3398259319004"
Test #42:
score: 0
Accepted
time: 3ms
memory: 4080kb
input:
1 98 87 0 0 2 3 3 3 1 1 3 2 2 3 1 1 3 3 1 0 1 3 4 3 2 2 3 4 3 1 1 2 3 4 3 2 3 2 1 1 1 3 4 4 3 1 1 2 1 1 2 3 2 2 2 1 3 3 3 4 4 3 2 2 3 2 1 2 1 0 1 3 4 2 0 0 0 2 4 3 2 2 1 2 4 3 2 1 1 1 2 2 3 4 4 2 1 3 2 1 2 2 2 3 4 2 0 1 3 4 3 3 4 4 3 3 3 3 3 3 3 3 3 2 2 2 2 2 3 4 3 2 1 0 1 2 2 3 4 3 3 3 3 3 2 2 2 3 ...
output:
3551007110889
result:
ok 1 number(s): "3551007110889"
Test #43:
score: 0
Accepted
time: 1ms
memory: 4232kb
input:
1 65 44 2 1 1 3 3 2 3 4 4 4 3 2 1 1 2 1 0 2 2 1 3 2 0 2 4 2 1 2 1 1 2 2 3 3 1 1 1 1 1 1 3 4 2 1 1 2 3 3 2 2 2 2 3 4 4 3 2 2 2 2 1 1 1 2 3 1 1 3 4 2 1 2 2 3 2 2 4 3 1 2 2 1 1 1 3 4 2 1 2 2 2 1 0 1 1 0 1 2 3 3 3 4 2 1 1 1 1 1 1 0 2 4 4 2 1 1 2 3 2 3 4 3 1 1 1 1 2 2 3 3 2 2 4 3 1 1 2 1 1 1 1 2 3 4 4 4 ...
output:
1184819537822
result:
ok 1 number(s): "1184819537822"
Test #44:
score: 0
Accepted
time: 2ms
memory: 4132kb
input:
1 96 57 3 2 2 4 2 1 2 1 2 4 4 3 1 1 3 4 3 3 2 0 2 4 4 2 1 1 1 3 2 2 4 3 1 2 4 4 3 1 1 1 2 3 2 1 0 1 3 4 3 1 1 2 2 2 2 3 4 3 3 2 3 2 1 3 2 2 4 4 3 1 2 3 2 2 3 2 1 2 2 3 3 2 2 2 2 2 2 3 4 2 2 3 3 3 1 1 1 2 3 2 1 1 1 2 4 3 1 1 2 2 3 4 4 4 4 3 1 2 2 1 2 2 3 4 4 3 2 3 3 2 2 3 2 2 2 1 2 2 3 4 3 2 3 3 3 3 ...
output:
2270259818310
result:
ok 1 number(s): "2270259818310"
Test #45:
score: 0
Accepted
time: 3ms
memory: 4088kb
input:
1 98 99 1 2 2 1 2 3 3 4 4 4 3 1 1 1 2 4 3 2 2 1 1 2 3 2 0 1 2 2 3 2 1 3 2 0 0 2 4 4 3 3 4 3 2 2 2 2 1 2 2 1 2 3 3 2 2 1 2 2 2 4 3 3 4 2 1 2 1 1 2 1 2 3 3 2 1 3 2 1 1 1 3 3 3 2 1 3 3 2 3 3 2 3 3 1 1 3 4 3 1 0 0 1 1 2 4 3 2 2 3 3 1 1 2 2 2 3 3 2 1 1 2 3 2 1 2 2 3 3 2 1 1 1 0 0 2 4 3 1 1 3 3 1 1 2 1 0 ...
output:
4035110973411
result:
ok 1 number(s): "4035110973411"
Test #46:
score: 0
Accepted
time: 2ms
memory: 4120kb
input:
1 88 77 3 3 2 1 1 3 3 1 2 2 1 2 2 2 2 2 1 0 1 2 2 1 1 2 2 2 1 2 2 1 3 3 3 2 1 2 3 2 0 0 2 4 4 3 2 3 3 2 2 2 3 2 2 3 1 2 4 3 1 1 3 4 2 0 1 1 2 2 2 2 0 2 2 0 0 2 4 1 3 4 2 1 2 2 2 3 3 3 2 1 3 4 3 2 1 1 2 3 2 1 2 2 2 1 1 1 1 3 3 2 1 2 3 2 1 0 0 2 4 3 2 3 3 1 2 4 3 3 3 2 2 2 3 3 3 3 2 2 2 2 2 3 3 2 2 3 ...
output:
2800459905626
result:
ok 1 number(s): "2800459905626"
Test #47:
score: 0
Accepted
time: 0ms
memory: 4048kb
input:
1 82 81 2 3 2 2 4 2 2 3 2 3 4 3 2 3 2 2 4 3 2 1 0 1 2 1 2 4 4 4 4 3 2 1 2 2 1 3 3 2 3 4 2 2 3 3 2 0 2 4 4 2 0 0 0 2 4 2 1 1 1 2 1 2 2 1 2 2 3 3 3 3 2 1 2 2 1 3 2 1 1 1 3 4 3 1 1 2 1 2 3 3 3 2 3 3 2 2 2 2 2 3 3 2 3 2 0 1 3 4 4 3 3 3 2 2 2 3 3 3 4 4 3 1 2 2 2 2 0 2 3 3 3 1 0 0 1 2 2 2 1 0 1 1 1 1 0 1 ...
output:
2797985316848
result:
ok 1 number(s): "2797985316848"
Test #48:
score: 0
Accepted
time: 3ms
memory: 4360kb
input:
1 94 97 1 3 3 2 3 2 2 3 1 2 3 3 2 0 1 1 2 3 3 2 0 1 1 1 2 3 3 2 1 1 3 3 3 3 1 1 1 2 2 1 1 1 3 2 2 3 2 1 1 3 3 1 2 4 3 1 1 2 2 1 1 1 0 1 1 2 4 4 3 1 2 3 1 0 0 1 3 3 1 1 3 3 3 3 1 1 3 3 1 1 3 2 1 3 2 1 3 3 3 1 1 3 2 1 1 1 2 3 4 2 1 3 3 2 3 4 3 1 2 3 2 3 4 3 2 1 1 2 3 4 4 2 2 3 2 1 2 3 3 4 2 1 2 3 3 3 ...
output:
3788439566338
result:
ok 1 number(s): "3788439566338"
Test #49:
score: 0
Accepted
time: 3ms
memory: 4060kb
input:
1 93 100 2 2 2 3 4 3 2 1 1 3 3 2 2 3 3 2 2 2 3 2 2 2 0 1 2 2 3 3 2 1 0 2 3 3 3 1 1 2 2 2 2 1 1 2 2 1 0 1 1 0 0 0 0 1 1 2 3 1 0 2 4 2 2 2 2 2 2 3 2 1 0 2 2 2 4 3 1 0 1 2 2 2 3 3 3 4 2 1 2 2 1 2 4 2 1 1 1 3 3 1 4 3 3 3 2 2 3 3 2 2 2 1 2 4 3 3 4 4 3 2 2 1 1 3 3 1 1 2 3 2 1 2 2 3 4 2 1 2 2 2 3 2 2 3 2 1...
output:
3879967943430
result:
ok 1 number(s): "3879967943430"
Test #50:
score: 0
Accepted
time: 4ms
memory: 3864kb
input:
625 4 3 1 1 1 2 2 2 2 2 2 2 2 2 993376037 863911050 303836823 901238490 486712574 708006908 837217517 477808443 347130695 115514808 489553684 398759512 596840600 280503551 696860065 695918333 942896928 193399496 216232955 74284779 930393377 755505726 110017758 585487191 930827120 623433536 350909145...
output:
5225172045 2962605229 4675344713 4010926689 5612069642 -1 5356477273 6076355544 1885505998 6223493735 2509343117 4630038721 4852004402 6727543983 4265540348 -1 -1 5373657083 4687726688 5759595365 2342784497 4723356389 5276024727 -1 -1 -1 3879915130 6830081979 4571391109 4374935682 -1 -1 1906993021 3...
result:
ok 625 numbers
Test #51:
score: 0
Accepted
time: 1ms
memory: 4144kb
input:
100 9 10 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 1 2 2 1 1 2 1 1 1 2 1 1 1 2 2 1 2 2 2 2 2 2 2 1 2 1 2 2 1 1 1 2 1 2 1 2 1 2 2 2 1 1 2 1 1 2 1 2 1 1 2 2 2 1 2...
output:
-1 -1 -1 33 -1 70 -1 -1 -1 -1 -1 -1 -1 -1 53 -1 88 25 -1 72 19 84 -1 51 33 88 85 -1 -1 -1 -1 84 88 33 84 -1 -1 -1 -1 87 -1 88 -1 -1 -1 -1 50 24 67 -1 -1 -1 32 -1 -1 -1 92 82 42 -1 -1 -1 84 -1 50 -1 66 91 -1 -1 -1 65 84 -1 -1 84 25 -1 54 -1 -1 -1 -1 -1 -1 28 87 -1 19 39 -1 -1 26 36 -1 -1 -1 -1 85 45
result:
ok 100 numbers
Test #52:
score: 0
Accepted
time: 2ms
memory: 3864kb
input:
100 10 9 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 761449635 88388225 263931121 177782391 230898520 206448601 74007375 195296225 222895598 626535788 779016388 433...
output:
-1 9986762229 -1 -1 11086830468 -1 -1 26670663595 21987552607 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 16205912413 -1 -1 -1 -1 -1 15088998104 -1 16740773338 -1 22468899073 19284135176 16248830663 2257082186 -1 23543329632 20943017759 -1 -1 -1 -1 -1 10992223256 -1 10971978859 -1 15290967331 13741861730 -1...
result:
ok 100 numbers
Test #53:
score: 0
Accepted
time: 2ms
memory: 3852kb
input:
100 7 10 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 194712020 890541992 778091194 138927297 225999083 451832676 488752783 43235111 956855969 15471497 946329518 441178199 510864604 49440849 835744045 2478...
output:
27980757472 22126828405 -1 -1 23418288185 -1 -1 -1 -1 -1 -1 -1 -1 23402323201 -1 27330971863 -1 -1 28998689539 -1 -1 -1 25787415771 -1 20768934396 26840886231 -1 -1 27250735256 -1 21585524215 11965340602 20560650321 -1 -1 29907793022 -1 22838444128 -1 -1 -1 28479515413 -1 -1 21482236086 -1 245583938...
result:
ok 100 numbers
Test #54:
score: 0
Accepted
time: 1ms
memory: 4172kb
input:
20 19 18 1 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 1 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 1 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 1 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 1 2...
output:
125409768100 140563127601 73512396125 -1 -1 75236496893 36790490770 -1 45570940874 -1 62286754830 13670015315 -1 -1 -1 -1 34431400947 -1 -1 -1
result:
ok 20 numbers
Test #55:
score: 0
Accepted
time: 1ms
memory: 3940kb
input:
20 11 20 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 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 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 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...
output:
85343898114 -1 -1 -1 -1 -1 80792346097 -1 -1 141441780923 -1 143739737911 71930896556 -1 -1 75440908224 60060306912 110129739143 -1 47821702354
result:
ok 20 numbers
Test #56:
score: 0
Accepted
time: 2ms
memory: 3956kb
input:
4 48 35 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
618843898124 777164805569 322401978913 -1
result:
ok 4 number(s): "618843898124 777164805569 322401978913 -1"
Test #57:
score: 0
Accepted
time: 1ms
memory: 4004kb
input:
4 42 43 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
673112358009 -1 -1 -1
result:
ok 4 number(s): "673112358009 -1 -1 -1"
Test #58:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
1 24 27 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
240972755763
result:
ok 1 number(s): "240972755763"
Test #59:
score: 0
Accepted
time: 2ms
memory: 4016kb
input:
1 84 97 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
-1
result:
ok 1 number(s): "-1"
Test #60:
score: 0
Accepted
time: 2ms
memory: 3972kb
input:
1 54 95 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
1912319071098
result:
ok 1 number(s): "1912319071098"
Test #61:
score: 0
Accepted
time: 0ms
memory: 4020kb
input:
1 78 95 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
2713026118299
result:
ok 1 number(s): "2713026118299"
Test #62:
score: 0
Accepted
time: 0ms
memory: 4056kb
input:
1 100 83 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
3094159358772
result:
ok 1 number(s): "3094159358772"
Test #63:
score: 0
Accepted
time: 1ms
memory: 4112kb
input:
1 82 97 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
-1
result:
ok 1 number(s): "-1"
Test #64:
score: 0
Accepted
time: 2ms
memory: 4012kb
input:
1 92 63 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
2132057685598
result:
ok 1 number(s): "2132057685598"
Test #65:
score: 0
Accepted
time: 0ms
memory: 4360kb
input:
1 92 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
3380679347882
result:
ok 1 number(s): "3380679347882"
Test #66:
score: 0
Accepted
time: 0ms
memory: 4100kb
input:
1 99 100 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 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...
output:
3696868683347
result:
ok 1 number(s): "3696868683347"
Test #67:
score: 0
Accepted
time: 0ms
memory: 4060kb
input:
1 96 75 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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:
2693831203544
result:
ok 1 number(s): "2693831203544"