QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#314233 | #8177. Sum is Integer | ucup-team2303# | AC ✓ | 1670ms | 25864kb | C++17 | 2.1kb | 2024-01-25 14:50:11 | 2024-01-25 14:50:13 |
Judging History
answer
// #pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#define PB emplace_back
#define int long long
#define ll long long
#define vi vector<int>
#define siz(a) ((int) ((a).size()))
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
void print(vi n) { rep(i, 0, siz(n) - 1) cerr << n[i] << " \n"[i == siz(n) - 1]; }
const int N = 2e5;
int a;
long double t[N + 5];
map<int, int> mp;
struct s1 {
const int mod = 1e9 + 7;
int s[N + 5], inv[N + 5], tmp;
void init() {
tmp = 1;
rep(i, 1, N) (tmp *= i) %= mod;
// cerr << tmp << endl;
inv[0] = inv[1] = 1;
rep(i, 2, N) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
rep(i, 1, N) (inv[i] *= tmp) %= mod;
}
void ins(int i, int x, int y) {
s[i] = (s[i - 1] + x * inv[y] % mod) % mod;
}
int get(int i, int x) {return (s[i] - x * tmp % mod + mod) % mod;}
} s1;
struct s2 {
const int mod = 998244853;
int s[N + 5], inv[N + 5], tmp;
void init() {
tmp = 1;
rep(i, 1, N) (tmp *= i) %= mod;
// cerr << tmp << endl;
inv[0] = inv[1] = 1;
rep(i, 2, N) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
rep(i, 1, N) (inv[i] *= tmp) %= mod;
}
void ins(int i, int x, int y) {
s[i] = (s[i - 1] + x * inv[y] % mod) % mod;
}
int get(int i, int x) {return (s[i] - x * tmp % mod + mod) % mod;}
} s2;
signed main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> a;
mp[0] = 1;
int ans = 0, x, y;
s1.init(), s2.init();
rep(i, 1, a) {
cin >> x >> y;
t[i] = t[i - 1] + 1.0 * x / y;
s1.ins(i, x, y);
s2.ins(i, x, y);
x = t[i];
rep(j, x - 15, x + 15) if(mp.count(s1.get(i, j) * s2.mod + s2.get(i, j)))
ans += mp[s1.get(i, j) * s2.mod + s2.get(i, j)];
++mp[s1.get(i, x) * s2.mod + s2.get(i, x)];
}
cout << ans;
return cerr << endl << 1.0 * clock() / CLOCKS_PER_SEC << endl, 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 10092kb
input:
4 1 6 1 3 1 2 1 2
output:
2
result:
ok "2"
Test #2:
score: 0
Accepted
time: 7ms
memory: 10112kb
input:
5 1 1 2 2 3 3 4 4 5 5
output:
15
result:
ok "15"
Test #3:
score: 0
Accepted
time: 3ms
memory: 10084kb
input:
2 1 99999 99999 100000
output:
0
result:
ok "0"
Test #4:
score: 0
Accepted
time: 104ms
memory: 13400kb
input:
200000 82781 82781 86223 86223 16528 16528 84056 84056 94249 94249 54553 54553 25943 25943 10415 10415 52417 52417 46641 46641 70298 70298 84228 84228 55441 55441 49326 49326 11753 11753 89499 89499 58220 58220 71482 71482 32373 32373 7251 7251 78573 78573 74268 74268 46682 46682 20314 20314 85519 8...
output:
10603308211
result:
ok "10603308211"
Test #5:
score: 0
Accepted
time: 109ms
memory: 13496kb
input:
200000 50741 50741 86798 95775 51104 51104 29372 29372 43295 43295 55065 55065 68947 68947 35282 35282 62467 62467 68481 68481 82613 82613 95921 95921 46302 46302 53806 53806 61244 61244 16078 16078 33476 33476 9084 9084 99273 99273 11678 11678 36816 36816 30311 30311 51479 51479 2667 2667 57043 570...
output:
20066919
result:
ok "20066919"
Test #6:
score: 0
Accepted
time: 192ms
memory: 14568kb
input:
200000 98235 98235 67434 96040 49102 49102 16569 16569 1095 1095 23901 23901 6143 6143 78285 78285 9853 9853 46454 46454 52131 52131 72378 72378 53983 53983 91453 91453 38655 83910 6455 6455 80993 80993 66871 66871 45005 45005 72124 72124 17949 17949 34378 34378 81399 81399 89147 89147 72892 72892 8...
output:
1808373
result:
ok "1808373"
Test #7:
score: 0
Accepted
time: 351ms
memory: 16500kb
input:
200000 64364 74993 65425 91573 10305 10305 31901 31901 90499 95090 13337 47707 32342 38531 75909 93251 95924 95924 12789 12789 77190 77190 82753 99616 33824 79787 48159 48159 32648 32648 90698 98365 89028 89028 36982 36982 11377 11377 79190 88165 23457 23457 24114 24114 55183 71128 65165 65165 4196 ...
output:
593601
result:
ok "593601"
Test #8:
score: 0
Accepted
time: 664ms
memory: 19564kb
input:
200000 42985 42985 30472 30472 4697 50160 91745 95118 77209 77209 32676 32676 96375 96550 18636 18636 93176 93202 27039 27039 2001 85497 74148 94045 82232 92935 71481 80579 99738 99977 90865 90865 93800 99894 11923 64394 29930 29930 40659 40659 12932 24625 47502 47502 34808 52414 37132 37132 78333 8...
output:
200046
result:
ok "200046"
Test #9:
score: 0
Accepted
time: 951ms
memory: 22652kb
input:
200000 38189 83791 82487 82487 42636 69054 46661 46661 55193 83194 40205 87111 29683 29683 79038 79038 98893 99029 1297 1297 29036 29036 14288 14288 92671 94553 93133 96764 20394 27614 51001 51001 95715 99182 57011 64387 40743 84877 53871 53871 9572 36322 52854 52854 48164 48164 54890 90222 13149 23...
output:
66793
result:
ok "66793"
Test #10:
score: 0
Accepted
time: 1474ms
memory: 25656kb
input:
200000 88510 92529 59515 86234 77518 89158 30499 67484 21592 66929 22068 85765 56040 80464 47128 86562 72993 74449 47648 55593 41645 65306 93686 98745 93577 97957 63897 92381 99261 99663 14073 53816 84719 96510 35202 78173 8823 28953 6740 40358 34790 66738 22323 83799 8982 93169 41275 70673 93933 99...
output:
2006
result:
ok "2006"
Test #11:
score: 0
Accepted
time: 1552ms
memory: 25836kb
input:
200000 37542 94781 52292 94781 41475 94781 64295 94781 19942 94781 20632 94781 23926 32922 15988 32922 70400 94781 33866 79612 73489 94781 11346 32922 29597 94781 18851 32922 75353 79612 10468 18421 68719 94781 30040 80989 27637 94781 9313 21313 26684 47093 10860 79612 2343 63521 2159 32922 4106 470...
output:
2
result:
ok "2"
Test #12:
score: 0
Accepted
time: 1599ms
memory: 25828kb
input:
200000 14155 82459 4550 92282 9935 59120 35119 43577 69681 92282 6573 33835 193 59120 2297 88354 33149 59120 21365 59120 14906 59120 4898 71617 802 25637 46411 59120 65015 92282 20057 71617 25342 71617 7440 82459 8525 71617 22625 25637 19203 82459 85531 92282 37402 71617 2660 82459 17454 33835 7833 ...
output:
5
result:
ok "5"
Test #13:
score: 0
Accepted
time: 1460ms
memory: 23768kb
input:
200000 1 2 2 3 4 5 3 7 7 11 6 13 9 17 15 19 17 23 12 29 18 31 10 37 23 41 41 43 20 47 24 53 12 59 14 61 63 67 59 71 16 73 42 79 15 83 18 89 12 97 4 101 91 103 13 107 86 109 3 113 53 127 84 131 112 137 22 139 37 149 58 151 153 157 160 163 156 167 41 173 91 179 66 181 29 191 64 193 107 197 91 199 158 ...
output:
41227
result:
ok "41227"
Test #14:
score: 0
Accepted
time: 1579ms
memory: 24048kb
input:
200000 1 2 1 3 2 5 5 7 5 11 7 13 16 17 6 19 16 23 20 29 23 31 16 37 29 41 2 43 13 47 28 53 3 59 10 61 47 67 1 71 39 73 13 79 56 83 26 89 81 97 11 101 16 103 84 107 17 109 77 113 122 127 4 131 79 137 41 139 146 149 29 151 104 157 64 163 84 167 5 173 25 179 124 181 140 191 45 193 112 197 71 199 166 21...
output:
39056
result:
ok "39056"
Test #15:
score: 0
Accepted
time: 1525ms
memory: 22904kb
input:
200000 1 2 1 3 2 5 5 7 5 11 7 13 16 17 6 19 16 23 20 29 23 31 16 37 29 41 2 43 13 47 28 53 3 59 10 61 47 67 1 71 39 73 13 79 56 83 26 89 81 97 11 101 16 103 84 107 17 109 77 113 122 127 4 131 79 137 41 139 146 149 29 151 104 157 64 163 84 167 5 173 25 179 124 181 140 191 45 193 112 197 71 199 166 21...
output:
59805
result:
ok "59805"
Test #16:
score: 0
Accepted
time: 1532ms
memory: 22612kb
input:
200000 1 2 1 3 2 5 5 7 5 11 7 13 16 17 6 19 16 23 20 29 23 31 16 37 29 41 2 43 13 47 28 53 3 59 10 61 47 67 1 71 39 73 13 79 56 83 26 89 81 97 11 101 16 103 84 107 17 109 77 113 122 127 4 131 79 137 41 139 146 149 29 151 104 157 64 163 84 167 5 173 25 179 124 181 140 191 45 193 112 197 71 199 166 21...
output:
66145
result:
ok "66145"
Test #17:
score: 0
Accepted
time: 956ms
memory: 20952kb
input:
137337 1 2 2 3 4 5 3 7 7 11 6 13 9 17 15 19 17 23 12 29 18 31 10 37 23 41 41 43 20 47 24 53 12 59 14 61 63 67 59 71 16 73 42 79 15 83 18 89 12 97 4 101 91 103 13 107 86 109 3 113 53 127 84 131 112 137 22 139 37 149 58 151 153 157 160 163 156 167 41 173 91 179 66 181 29 191 64 193 107 197 91 199 158 ...
output:
0
result:
ok "0"
Test #18:
score: 0
Accepted
time: 729ms
memory: 18316kb
input:
112633 1 2 2 3 4 5 3 7 7 11 6 13 9 17 15 19 17 23 12 29 18 31 10 37 23 41 41 43 20 47 24 53 12 59 14 61 63 67 59 71 16 73 42 79 15 83 18 89 12 97 4 101 91 103 13 107 86 109 3 113 53 127 84 131 112 137 22 139 37 149 58 151 153 157 160 163 156 167 41 173 91 179 66 181 29 191 64 193 107 197 91 199 158 ...
output:
0
result:
ok "0"
Test #19:
score: 0
Accepted
time: 211ms
memory: 13504kb
input:
48424 1 2 2 3 4 5 3 7 7 11 6 13 9 17 15 19 17 23 12 29 18 31 10 37 23 41 41 43 20 47 24 53 12 59 14 61 63 67 59 71 16 73 42 79 15 83 18 89 12 97 4 101 91 103 13 107 86 109 3 113 53 127 84 131 112 137 22 139 37 149 58 151 153 157 160 163 156 167 41 173 91 179 66 181 29 191 64 193 107 197 91 199 158 2...
output:
0
result:
ok "0"
Test #20:
score: 0
Accepted
time: 1053ms
memory: 24876kb
input:
187753 1 2 1 3 2 5 5 7 5 11 7 13 16 17 6 19 16 23 20 29 23 31 16 37 29 41 2 43 13 47 28 53 3 59 10 61 47 67 1 71 39 73 13 79 56 83 26 89 81 97 11 101 16 103 84 107 17 109 77 113 122 127 4 131 79 137 41 139 146 149 29 151 104 157 64 163 84 167 5 173 25 179 124 181 140 191 45 193 112 197 71 199 166 21...
output:
0
result:
ok "0"
Test #21:
score: 0
Accepted
time: 923ms
memory: 23708kb
input:
173667 1 2 1 3 2 5 5 7 5 11 7 13 16 17 6 19 16 23 20 29 23 31 16 37 29 41 2 43 13 47 28 53 3 59 10 61 47 67 1 71 39 73 13 79 56 83 26 89 81 97 11 101 16 103 84 107 17 109 77 113 122 127 4 131 79 137 41 139 146 149 29 151 104 157 64 163 84 167 5 173 25 179 124 181 140 191 45 193 112 197 71 199 166 21...
output:
0
result:
ok "0"
Test #22:
score: 0
Accepted
time: 1135ms
memory: 25764kb
input:
200000 1 2 1 3 2 5 5 7 5 11 7 13 16 17 6 19 16 23 20 29 23 31 16 37 29 41 2 43 13 47 28 53 3 59 10 61 47 67 1 71 39 73 13 79 56 83 26 89 81 97 11 101 16 103 84 107 17 109 77 113 122 127 4 131 79 137 41 139 146 149 29 151 104 157 64 163 84 167 5 173 25 179 124 181 140 191 45 193 112 197 71 199 166 21...
output:
0
result:
ok "0"
Test #23:
score: 0
Accepted
time: 14ms
memory: 12232kb
input:
11032 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
32611835
result:
ok "32611835"
Test #24:
score: 0
Accepted
time: 90ms
memory: 13392kb
input:
197164 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1...
output:
7012456789
result:
ok "7012456789"
Test #25:
score: 0
Accepted
time: 72ms
memory: 12240kb
input:
152617 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1...
output:
3698154517
result:
ok "3698154517"
Test #26:
score: 0
Accepted
time: 28ms
memory: 12380kb
input:
51168 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 5 1 ...
output:
140488539
result:
ok "140488539"
Test #27:
score: 0
Accepted
time: 1251ms
memory: 24872kb
input:
193934 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100000 1 100...
output:
8327
result:
ok "8327"
Test #28:
score: 0
Accepted
time: 766ms
memory: 18848kb
input:
143685 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 99999 1 999...
output:
41222
result:
ok "41222"
Test #29:
score: 0
Accepted
time: 635ms
memory: 20764kb
input:
140833 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 99998 1 999...
output:
0
result:
ok "0"
Test #30:
score: 0
Accepted
time: 96ms
memory: 13396kb
input:
200000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000 100000...
output:
10687007638
result:
ok "10687007638"
Test #31:
score: 0
Accepted
time: 6ms
memory: 10180kb
input:
1000 155 1129 42123 42937 53055 56269 84026 89671 36 59 48552 64783 15754 29599 24054 35407 15451 21617 2093 58441 65844 86959 17502 77641 40827 66569 26523 95089 8906 38069 36696 41687 12551 16981 18568 49103 10523 19507 19599 45751 970 7951 6346 61441 5486 12239 80215 87133 11572 43457 42895 48821...
output:
1
result:
ok "1"
Test #32:
score: 0
Accepted
time: 9ms
memory: 10168kb
input:
1072 23184 65839 4268 65843 11075 12487 33343 49757 62837 74717 91526 94693 7014 10459 5497 9371 15993 29741 85921 98669 64910 74197 15087 22229 25783 61381 110 241 32062 36473 16770 28627 17493 23473 15377 15467 509 1619 6541 31957 4299 21377 22010 49411 7335 17231 6477 38201 4617 5869 10432 13147 ...
output:
1
result:
ok "1"
Test #33:
score: 0
Accepted
time: 4ms
memory: 10352kb
input:
970 2066 13291 2775 25939 8058 9029 2218 8893 28676 55487 28912 36073 3193 15881 19577 49993 1925 25849 37099 53629 33112 47609 4410 13789 7396 9767 10521 13577 25025 31907 7917 55291 54695 62969 11204 86959 13022 16829 61908 75083 37351 37423 8731 40231 12005 26189 8559 40853 35811 78283 10828 3235...
output:
1
result:
ok "1"
Test #34:
score: 0
Accepted
time: 59ms
memory: 12756kb
input:
30185 2 6 9 9 9 10 7 7 7 10 10 10 1 2 8 8 4 7 2 8 8 8 9 10 4 4 8 9 1 2 4 9 5 9 8 8 5 10 6 9 6 10 6 7 7 9 6 9 5 10 2 10 9 10 9 9 5 7 9 10 5 10 4 7 10 10 7 8 7 10 8 10 4 10 2 3 9 10 10 10 3 10 5 6 9 9 10 10 1 9 4 7 6 9 2 3 9 9 4 7 2 2 5 10 10 10 6 10 2 8 9 9 4 5 3 7 2 2 3 6 10 10 7 9 8 9 4 5 1 6 4 4 4...
output:
115097
result:
ok "115097"
Test #35:
score: 0
Accepted
time: 175ms
memory: 12896kb
input:
82975 6 10 4 7 5 10 1 1 5 5 5 8 3 10 7 8 10 10 10 10 9 10 5 7 10 10 6 9 10 10 5 10 6 10 1 7 5 7 9 10 1 3 5 7 9 9 10 10 10 10 9 10 8 10 9 9 2 4 2 9 8 9 5 10 6 7 2 6 9 10 7 8 9 10 4 9 7 10 9 9 6 10 3 3 9 9 7 8 7 8 7 9 8 8 8 9 4 4 4 4 7 10 9 10 10 10 7 8 9 10 9 10 9 9 5 9 10 10 3 8 1 2 4 10 9 10 1 2 7 ...
output:
1078095
result:
ok "1078095"
Test #36:
score: 0
Accepted
time: 304ms
memory: 12576kb
input:
154244 6 9 8 10 4 4 5 5 9 9 3 9 10 10 2 7 3 5 2 3 2 8 7 10 6 10 8 8 2 5 10 10 5 6 4 4 6 6 4 4 5 7 4 8 5 5 2 8 10 10 2 2 8 8 6 8 1 9 4 8 2 5 4 9 7 10 3 9 9 9 3 3 4 4 9 9 9 9 2 4 9 10 5 5 8 8 2 3 5 8 6 10 1 9 3 7 10 10 5 8 3 5 8 9 8 8 2 7 10 10 2 9 3 8 8 10 3 9 10 10 5 8 2 9 6 9 5 10 8 10 10 10 1 7 6 ...
output:
2570774
result:
ok "2570774"
Test #37:
score: 0
Accepted
time: 68ms
memory: 10652kb
input:
31108 4 7 10 10 5 10 3 7 2 6 10 10 2 2 8 9 8 10 7 7 5 8 4 5 3 4 5 7 5 5 10 10 5 8 7 10 10 10 1 6 8 8 5 7 6 9 7 7 6 7 6 6 8 10 7 8 3 9 10 10 6 10 10 10 10 10 5 5 3 7 2 3 10 10 9 10 8 9 8 10 7 8 9 9 9 9 8 10 9 9 3 9 9 9 10 10 4 5 5 8 8 10 9 9 6 9 5 10 9 9 7 10 9 9 10 10 5 6 2 2 2 10 2 3 8 8 4 10 1 9 9...
output:
107255
result:
ok "107255"
Test #38:
score: 0
Accepted
time: 36ms
memory: 10876kb
input:
15206 6 6 6 10 8 10 3 5 3 8 10 10 5 10 4 4 6 7 5 6 1 8 4 6 4 7 4 4 1 3 9 10 10 10 9 9 2 8 8 8 1 3 4 10 9 9 2 7 3 8 5 9 3 9 1 2 4 4 7 7 8 8 8 8 5 7 7 10 6 6 4 4 4 7 3 8 10 10 10 10 10 10 6 10 1 8 8 9 8 8 1 5 10 10 9 9 10 10 4 8 7 9 6 10 3 7 7 9 1 7 6 7 2 5 3 10 4 5 8 8 4 9 6 8 7 10 4 5 3 5 4 5 8 9 7 ...
output:
27575
result:
ok "27575"
Test #39:
score: 0
Accepted
time: 74ms
memory: 10892kb
input:
33942 1 1 9 9 2 10 4 6 8 8 1 9 3 3 5 10 3 4 4 8 2 2 5 7 8 9 10 10 1 3 6 8 2 6 5 8 7 9 5 5 1 10 5 10 1 2 4 7 10 10 8 10 8 8 1 1 5 10 10 10 1 6 2 9 4 5 6 9 6 9 6 6 4 7 7 8 9 9 4 9 1 6 9 9 1 5 1 9 7 9 4 10 1 6 3 4 1 10 5 5 6 7 7 8 7 10 5 9 7 9 9 10 9 9 9 10 4 9 1 6 6 8 8 10 10 10 3 5 3 9 9 9 3 7 3 7 2 ...
output:
129646
result:
ok "129646"
Test #40:
score: 0
Accepted
time: 113ms
memory: 10864kb
input:
52270 5 6 4 4 9 9 9 9 6 6 7 8 3 4 3 6 2 8 9 10 10 10 3 7 6 8 7 9 2 9 3 7 1 4 2 9 2 5 2 10 3 4 8 8 10 10 3 6 8 8 8 10 7 8 4 5 8 9 9 9 3 5 6 9 5 9 10 10 8 9 10 10 8 9 4 6 1 2 2 5 2 9 7 8 7 8 9 10 5 9 8 9 7 7 8 10 1 6 6 8 7 9 2 5 10 10 3 7 8 10 3 10 5 6 2 10 2 10 4 7 4 8 9 10 6 7 4 8 3 7 9 9 1 2 5 10 9...
output:
355057
result:
ok "355057"
Test #41:
score: 0
Accepted
time: 147ms
memory: 11164kb
input:
73881 5 10 7 10 3 8 2 7 7 10 7 8 10 10 1 3 3 9 6 10 8 8 2 4 1 1 7 10 10 10 6 10 3 4 2 4 2 3 9 9 8 8 2 2 5 10 7 8 2 2 7 8 7 8 6 10 10 10 2 3 2 9 10 10 3 10 7 8 6 9 1 4 10 10 10 10 6 10 4 6 4 10 5 5 1 6 6 7 9 10 10 10 10 10 10 10 8 8 3 7 8 10 3 10 7 10 1 7 7 7 4 7 6 8 10 10 9 10 9 9 2 2 1 6 4 9 5 7 5 ...
output:
570346
result:
ok "570346"
Test #42:
score: 0
Accepted
time: 63ms
memory: 10596kb
input:
31299 8 10 3 3 5 8 9 10 6 10 4 9 9 9 5 7 8 10 3 9 5 8 10 10 7 9 2 3 2 3 1 9 4 8 8 9 6 8 9 9 10 10 1 9 5 9 4 5 4 5 9 10 10 10 2 10 8 9 8 10 10 10 6 9 6 7 5 9 4 4 5 10 6 8 9 9 8 9 10 10 9 9 7 10 3 5 6 7 7 9 8 9 3 8 7 7 10 10 3 4 2 9 5 10 4 5 8 10 1 3 1 2 6 6 10 10 2 9 10 10 8 8 7 10 9 10 9 9 8 10 10 1...
output:
187751
result:
ok "187751"
Test #43:
score: 0
Accepted
time: 230ms
memory: 13044kb
input:
110539 6 6 2 10 8 9 1 6 2 5 7 8 2 5 9 10 7 10 1 5 10 10 5 7 1 8 7 10 7 10 1 1 6 7 3 3 8 8 5 7 1 8 2 3 7 9 4 6 7 8 5 8 5 7 4 8 2 2 1 7 5 7 4 9 7 8 6 10 10 10 8 8 7 9 4 4 8 9 8 8 3 10 4 8 10 10 7 10 7 10 3 6 8 10 6 7 6 6 7 10 5 5 8 9 8 9 5 6 10 10 10 10 3 10 3 9 6 10 2 10 5 7 10 10 6 9 8 8 7 8 5 8 4 9...
output:
1387215
result:
ok "1387215"
Test #44:
score: 0
Accepted
time: 667ms
memory: 18460kb
input:
110772 914 957 2 801 14 171 312 902 749 793 392 514 431 770 832 948 434 570 941 968 28 590 637 908 226 280 758 809 607 918 986 987 199 471 737 910 780 791 573 733 404 813 764 969 111 867 532 820 16 800 718 749 999 999 420 929 736 863 906 954 682 711 22 488 939 981 709 904 125 133 129 343 37 934 349 ...
output:
804
result:
ok "804"
Test #45:
score: 0
Accepted
time: 1378ms
memory: 24584kb
input:
185368 406 988 30 287 902 921 21 907 155 276 258 785 965 976 520 809 39 783 479 741 648 923 578 694 71 911 180 291 520 871 38 457 279 918 88 971 974 974 973 987 353 509 504 734 399 638 997 998 364 846 153 588 424 941 465 896 70 84 295 700 661 719 806 928 859 897 499 511 376 638 282 588 155 550 979 9...
output:
1404
result:
ok "1404"
Test #46:
score: 0
Accepted
time: 401ms
memory: 17756kb
input:
80624 561 929 218 448 718 902 982 987 845 883 752 956 955 974 206 613 699 875 187 770 911 949 519 661 861 891 844 923 982 1000 196 855 822 927 823 823 405 902 251 891 125 325 963 990 590 707 109 375 218 453 782 785 550 732 471 724 581 697 9 853 885 928 338 405 579 882 975 980 214 879 131 383 111 193...
output:
621
result:
ok "621"
Test #47:
score: 0
Accepted
time: 968ms
memory: 20948kb
input:
143557 402 538 947 965 576 612 462 532 514 908 750 972 217 241 864 989 22 376 575 802 353 366 493 821 425 514 494 519 373 458 571 799 853 883 78 383 253 990 835 909 480 659 574 807 692 722 432 697 752 859 36 993 521 609 793 946 662 893 92 245 856 922 513 659 684 907 938 982 800 954 650 975 997 998 3...
output:
1127
result:
ok "1127"
Test #48:
score: 0
Accepted
time: 553ms
memory: 17256kb
input:
97315 921 978 44 442 730 995 55 424 211 642 549 943 713 996 603 855 404 815 111 336 135 421 106 146 499 633 812 962 235 398 702 801 840 979 935 979 476 800 792 915 858 996 807 875 444 701 704 942 266 963 319 872 250 526 993 993 885 954 388 876 242 872 918 983 524 607 23 890 914 969 493 997 408 552 5...
output:
769
result:
ok "769"
Test #49:
score: 0
Accepted
time: 1384ms
memory: 24096kb
input:
174383 76731 80769 85582 95535 19527 43540 94601 99568 38575 56730 35290 87476 10792 96791 80394 97170 51523 64441 32819 90767 63286 64139 65364 74552 294 71141 33859 62528 93404 99486 84072 93907 73792 97534 68529 91753 79929 87975 80139 94432 38293 83292 55685 70159 39853 82939 26848 51659 97417 9...
output:
25
result:
ok "25"
Test #50:
score: 0
Accepted
time: 515ms
memory: 17044kb
input:
93777 87944 91152 62892 65645 48426 87227 60393 82604 79777 85414 73837 97347 24107 96990 42891 57126 21472 58814 6801 57465 35241 62362 11812 55806 75917 91116 85731 87423 964 57294 59594 78952 78592 91255 8220 92844 60447 60847 86613 98669 62965 84627 35882 52545 64305 65671 92560 96711 4709 43293...
output:
10
result:
ok "10"
Test #51:
score: 0
Accepted
time: 772ms
memory: 20632kb
input:
121407 75963 92805 24546 54809 68230 69763 10782 42279 57172 63316 19130 87426 11545 62298 47498 91468 57257 92032 83542 88387 88861 94437 90291 95231 17733 44223 60789 68488 97001 97378 90442 92111 11659 60597 43262 44779 38870 98005 66176 75009 90483 92721 52768 82985 58408 77859 93391 95806 90461...
output:
10
result:
ok "10"
Test #52:
score: 0
Accepted
time: 1397ms
memory: 25068kb
input:
191232 60186 71460 31957 58347 21651 93700 68170 83397 47616 88359 24312 88455 44040 77256 81853 92907 11023 42472 69440 70079 60063 68260 45812 88833 52768 71301 92138 99441 8668 43189 75977 92087 94537 97781 59848 98664 744 64125 67663 83344 18730 32164 88050 93152 48528 83722 82036 99773 75264 92...
output:
21
result:
ok "21"
Test #53:
score: 0
Accepted
time: 186ms
memory: 14940kb
input:
43906 87915 96847 81273 99550 48700 50135 1358 28441 12646 92275 98632 98920 37813 68168 21427 36637 83036 89887 21771 60113 54940 86829 16113 89894 57706 60467 835 54265 20099 95356 34477 70331 12254 82997 28495 87764 77718 84667 29179 81009 15423 86791 93104 95631 94917 96000 46814 59063 38217 995...
output:
6
result:
ok "6"
Test #54:
score: 0
Accepted
time: 11ms
memory: 10152kb
input:
1774 37567 70592 43201 91437 23487 39287 3364 46553 27713 64954 60608 62209 44801 75576 5029 87679 93976 97206 91724 91753 60477 91040 69270 82652 71390 82966 44855 52372 47412 86699 90944 94082 42092 70069 77369 82664 66584 71354 12964 89901 54835 85054 22952 82050 31955 68706 85504 99610 52874 945...
output:
0
result:
ok "0"
Test #55:
score: 0
Accepted
time: 7ms
memory: 10208kb
input:
1800 32974 81533 16669 29888 93281 96507 94460 95605 55920 65922 42778 76669 69836 93949 64093 95925 57774 68096 8034 38375 48032 57942 57468 84556 58308 71521 63078 73104 96078 96254 2246 43247 70510 85361 91132 94357 62916 68027 51146 58479 42935 79272 69657 74810 43282 46997 22472 87407 55699 784...
output:
0
result:
ok "0"
Test #56:
score: 0
Accepted
time: 10ms
memory: 10004kb
input:
1518 59191 78247 755 28517 92246 96620 3272 10839 49333 96489 21708 71903 15460 17938 44600 53021 69185 74246 42516 94516 9079 88330 93456 97904 63143 88073 29205 67369 60109 92814 91463 93217 11679 24174 19369 57984 11816 15011 60627 84552 93747 94801 1228 32824 53999 95848 54128 64230 60091 98650 ...
output:
0
result:
ok "0"
Test #57:
score: 0
Accepted
time: 11ms
memory: 10252kb
input:
1528 33112 61031 28427 39003 11377 49891 46672 53067 33232 49212 4633 72869 24045 54455 22277 29616 31520 71751 25296 43842 91557 96629 73788 86708 84635 89189 93834 99738 69097 96992 56405 69231 78604 98017 3838 86064 85161 95463 41424 52399 90273 99063 40180 97529 39432 65486 74584 79301 16940 197...
output:
0
result:
ok "0"
Test #58:
score: 0
Accepted
time: 11ms
memory: 10220kb
input:
1763 12939 97368 33041 98236 11715 45482 1719 57632 87676 90558 27668 29623 79058 97865 91402 97378 39917 67148 12302 84641 27194 35415 96153 97371 79754 88183 78688 96934 17757 21309 8823 69987 27660 62073 88455 92507 55464 80507 64762 64949 27411 66886 63560 76499 7028 59352 93173 97096 42572 7827...
output:
1
result:
ok "1"
Test #59:
score: 0
Accepted
time: 1591ms
memory: 25812kb
input:
200000 74315 93217 25846 34468 2523 34907 30463 61813 51848 70658 97774 99836 55765 75465 63957 93101 88114 92292 96717 97357 12011 83987 93051 97530 80066 96531 7433 78113 60967 96641 99273 99301 88802 96129 10778 31592 52534 97659 1438 63315 69405 86265 77394 78241 37692 50742 6403 74250 19398 278...
output:
26
result:
ok "26"
Test #60:
score: 0
Accepted
time: 1670ms
memory: 25820kb
input:
200000 61852 70790 64911 87515 56632 77757 32925 42571 66821 94204 21143 64398 50884 62267 55345 61701 35666 69162 57329 82265 80655 93118 26343 92565 24759 55374 79185 95023 75569 88041 17199 72837 49396 71904 44586 75753 20404 47643 64854 87074 88607 91720 9240 56600 73700 87357 15118 57088 36800 ...
output:
20
result:
ok "20"
Test #61:
score: 0
Accepted
time: 1603ms
memory: 25740kb
input:
200000 25522 56519 44534 99842 70676 83315 49728 75079 92311 96965 13472 56857 34531 91033 46225 74142 20696 45316 37103 61615 93786 94183 42078 73170 9490 63324 59823 99830 45412 76251 30087 69067 48911 92255 69749 86481 36893 71063 65084 99270 97205 97286 73308 99759 39604 71707 36115 82097 99214 ...
output:
18
result:
ok "18"
Test #62:
score: 0
Accepted
time: 1633ms
memory: 25776kb
input:
200000 49183 97119 2893 60208 26461 76165 98973 99426 96301 99550 63543 74867 88462 99444 2221 36607 79573 80362 28488 52296 89862 90975 11367 32542 49223 78548 84252 99751 87847 94592 47991 80180 90087 97401 42105 91428 66048 67588 66214 78112 3242 64538 6583 13010 49720 72487 85173 89483 33454 862...
output:
24
result:
ok "24"
Test #63:
score: 0
Accepted
time: 1601ms
memory: 25864kb
input:
200000 95248 98622 27567 31521 50592 94404 81684 95553 81753 83838 76373 79050 31604 73027 68794 91040 96693 98125 96812 99768 3675 78308 38714 84314 57755 71057 81170 96504 81349 87696 35313 57443 95904 96455 91273 95488 62429 94946 44334 98062 57782 58133 94380 99635 82896 86147 28826 40501 88698 ...
output:
22
result:
ok "22"
Test #64:
score: 0
Accepted
time: 84ms
memory: 13344kb
input:
200000 10 10 17 17 1 1 30 30 20 20 11 11 14 14 8 8 1 1 27 27 4 4 18 18 4 4 15 15 17 17 13 13 24 24 4 4 23 23 9 9 13 13 2 2 23 23 9 9 18 18 7 7 4 4 19 19 28 28 26 26 9 9 24 24 11 11 23 23 2 2 12 12 6 6 24 24 13 13 5 5 26 26 12 12 14 14 3 3 2 2 11 11 17 17 21 21 13 13 6 6 5 5 28 28 2 2 9 9 6 6 8 8 27 ...
output:
20000100000
result:
ok "20000100000"
Test #65:
score: 0
Accepted
time: 155ms
memory: 14424kb
input:
200000 1 1 27 27 23 23 26 26 22 26 9 9 19 19 13 13 26 26 23 23 24 24 9 9 13 13 10 10 16 16 5 5 6 6 10 10 1 1 25 25 29 29 11 11 1 1 25 25 18 18 5 5 4 29 22 22 16 16 4 4 11 11 3 3 23 26 27 27 5 5 3 9 3 3 12 12 22 22 1 1 27 27 14 14 4 4 12 12 27 27 14 14 23 30 22 22 23 23 14 14 10 10 19 19 29 29 14 24 ...
output:
2113979
result:
ok "2113979"
Test #66:
score: 0
Accepted
time: 571ms
memory: 18652kb
input:
200000 17 24 2 2 24 24 4 4 7 7 20 30 13 13 16 16 20 20 25 29 7 7 8 13 5 5 6 15 12 12 30 30 23 25 11 12 23 23 20 20 24 24 26 28 7 8 25 28 9 9 7 28 20 20 7 7 30 30 30 30 3 9 23 25 12 12 6 6 22 22 1 1 21 21 18 18 19 24 29 29 5 5 11 11 23 23 1 1 16 26 19 23 17 23 8 8 15 20 25 25 20 20 24 24 10 27 20 20 ...
output:
263743
result:
ok "263743"
Test #67:
score: 0
Accepted
time: 1506ms
memory: 25844kb
input:
199990 1 7 7 11 5 13 5 17 13 16 1 19 19 23 6 25 10 27 7 29 1 7 5 11 1 13 7 17 3 16 14 19 2 23 19 25 2 27 2 29 6 7 9 11 3 13 13 17 5 16 3 19 6 23 11 25 8 27 25 29 1 7 1 11 4 13 10 17 11 16 4 19 9 23 7 25 10 27 27 29 1 7 3 11 10 13 12 17 9 16 3 19 10 23 19 25 22 27 11 29 3 7 5 11 5 13 5 17 9 16 11 19 ...
output:
0
result:
ok "0"
Test #68:
score: 0
Accepted
time: 91ms
memory: 13324kb
input:
200000 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 30 1 3...
output:
666573336
result:
ok "666573336"
Test #69:
score: 0
Accepted
time: 304ms
memory: 16676kb
input:
69918 21 27 11 29 11 27 18 19 15 17 1 25 10 12 9 29 1 21 10 17 9 19 4 4 12 22 7 28 4 27 16 21 4 27 7 9 4 30 8 24 3 15 16 23 17 23 3 5 15 15 21 25 1 7 5 12 17 27 17 26 16 17 5 7 3 11 9 27 8 11 21 22 2 2 19 26 16 21 7 9 18 21 12 21 1 4 2 23 21 27 16 23 5 17 27 28 5 7 18 27 8 28 4 22 18 21 4 17 17 29 1...
output:
3035
result:
ok "3035"
Test #70:
score: 0
Accepted
time: 12ms
memory: 10804kb
input:
4206 9 12 24 25 3 9 10 29 20 28 4 24 11 26 7 23 13 18 7 30 11 18 12 22 8 11 18 25 3 27 7 30 6 7 25 27 3 19 5 14 15 19 13 19 7 16 8 27 2 6 18 26 1 29 17 22 1 22 1 28 12 14 6 30 1 18 18 23 10 22 16 25 19 24 8 28 11 30 26 27 9 18 13 29 20 29 10 23 16 30 2 13 22 30 11 12 13 14 14 29 15 19 22 27 1 14 5 1...
output:
174
result:
ok "174"
Test #71:
score: 0
Accepted
time: 1424ms
memory: 25300kb
input:
199951 11 26 13 23 2 13 25 25 20 28 12 24 13 30 12 13 14 21 15 21 5 18 11 30 16 18 10 18 5 26 14 21 10 12 16 28 2 23 13 25 10 28 4 22 18 27 15 17 7 16 15 26 1 27 14 29 1 16 14 30 9 11 8 10 8 20 16 22 14 15 3 8 19 25 12 18 1 12 2 28 14 16 2 12 8 26 13 24 8 9 3 3 6 8 10 14 7 11 2 29 2 29 3 18 7 13 3 9...
output:
8672
result:
ok "8672"
Test #72:
score: 0
Accepted
time: 791ms
memory: 19516kb
input:
126098 25 26 8 16 6 23 10 26 3 30 26 26 11 14 3 16 3 19 9 23 10 28 12 12 3 19 9 23 7 17 5 15 8 9 4 14 9 29 18 20 5 6 3 13 1 21 20 20 22 23 21 23 7 14 14 24 18 18 13 27 6 9 15 25 9 11 20 28 24 28 25 27 14 30 2 8 5 9 1 27 16 25 14 16 4 30 1 24 10 24 9 26 16 16 5 12 5 14 4 5 28 29 13 25 13 21 2 4 8 25 ...
output:
5644
result:
ok "5644"
Test #73:
score: 0
Accepted
time: 214ms
memory: 15688kb
input:
53265 23 26 2 16 9 10 24 29 5 21 5 17 5 9 9 13 1 29 8 29 2 3 18 26 1 3 7 21 17 27 24 27 9 11 10 17 5 7 17 20 6 22 30 30 4 20 27 30 5 18 3 30 7 20 11 17 2 4 1 30 8 8 12 22 8 16 15 21 14 18 5 19 7 29 7 28 22 28 11 27 6 8 19 28 26 29 14 25 18 25 2 13 13 25 1 19 5 11 8 13 20 27 2 22 9 17 29 29 4 20 19 2...
output:
2418
result:
ok "2418"
Test #74:
score: 0
Accepted
time: 387ms
memory: 15624kb
input:
81813 17 23 14 28 6 28 8 22 18 28 2 4 9 30 13 25 6 21 1 2 4 6 1 9 10 21 2 18 16 24 17 30 20 24 25 29 22 24 23 28 6 27 2 14 9 24 6 13 22 28 10 24 9 9 19 22 20 30 18 24 17 26 6 10 16 24 18 27 9 23 19 23 12 30 24 30 16 23 5 22 7 15 4 28 18 26 14 15 28 29 8 29 19 20 13 28 2 8 5 21 9 30 18 29 12 30 4 7 8...
output:
3639
result:
ok "3639"
Test #75:
score: 0
Accepted
time: 1062ms
memory: 22668kb
input:
168554 22 23 22 23 22 25 11 20 6 16 8 29 10 10 13 13 7 24 8 9 2 21 15 23 17 24 8 13 12 16 1 12 1 4 2 29 6 13 5 14 6 26 11 19 5 12 10 27 15 25 8 18 26 29 5 28 6 22 5 22 17 22 23 30 9 10 3 25 10 21 14 24 17 21 11 26 1 28 13 17 4 13 1 5 4 26 7 9 7 14 9 14 1 15 12 22 1 16 5 9 5 10 18 27 2 6 19 20 1 30 7...
output:
7201
result:
ok "7201"
Test #76:
score: 0
Accepted
time: 269ms
memory: 14748kb
input:
62596 3 9 18 27 12 13 8 10 12 20 16 16 20 24 8 13 11 24 8 9 14 27 8 21 7 10 12 14 14 15 10 30 9 10 6 14 2 21 2 21 13 14 5 19 7 10 22 29 15 29 7 12 5 7 16 28 15 29 13 26 10 19 8 22 10 26 28 29 21 26 2 16 10 18 11 20 5 29 20 23 5 20 8 22 21 29 10 22 16 27 9 12 25 27 9 27 14 20 10 15 4 29 4 23 4 23 19 ...
output:
2796
result:
ok "2796"
Test #77:
score: 0
Accepted
time: 106ms
memory: 12108kb
input:
29743 8 15 22 27 17 30 8 10 4 21 5 21 22 23 4 17 14 28 25 25 15 18 22 22 15 19 3 25 18 27 18 24 2 11 4 24 2 9 28 29 3 21 7 9 26 27 4 16 3 7 18 29 19 22 17 25 25 25 4 22 20 24 4 26 14 23 14 28 22 28 10 30 2 23 5 13 10 13 7 17 11 11 17 23 21 25 5 15 9 11 26 28 3 24 18 24 1 1 1 23 3 28 6 19 11 18 15 25...
output:
1300
result:
ok "1300"
Test #78:
score: 0
Accepted
time: 1009ms
memory: 22788kb
input:
170442 13 17 2 4 27 28 9 11 21 23 28 28 6 15 12 13 26 30 7 30 24 26 8 25 9 11 7 28 10 25 9 27 1 28 5 6 7 24 7 11 11 14 8 11 2 9 5 22 1 18 22 26 8 29 13 17 4 7 1 22 6 28 1 25 25 29 2 5 3 13 22 28 14 25 10 30 4 10 4 8 11 20 8 16 4 25 10 15 15 20 18 25 11 27 2 6 5 25 1 24 1 10 3 22 5 15 20 26 6 21 22 3...
output:
7453
result:
ok "7453"
Extra Test:
score: 0
Extra Test Passed