QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#471535 | #8364. permutation | Liuxizai | 100 ✓ | 496ms | 186636kb | C++20 | 2.5kb | 2024-07-10 21:53:00 | 2024-07-10 21:53:01 |
Judging History
answer
#include <bits/stdc++.h>
#define File(name) freopen(#name".in", "r", stdin); freopen(#name".out", "w", stdout);
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<typename T>
inline T read(){
T n = 0; int f = 1; char ch = getchar();
while(!isdigit(ch)){
if(ch == '-') f = -1;
ch = getchar();
}
while(isdigit(ch)){
n = n * 10 + ch - '0';
ch = getchar();
}
return f * n;
}
template<typename T>
void write(T n){
if(n < 0) return putchar('-'), write(-n);
if(n / 10) write(n / 10);
putchar(n % 10 + '0');
}
void input() {}
template<typename Type, typename... Types>
void input(Type &arg, Types &...args){
arg = read<Type>();
input(args...);
}
namespace Main{
const int N = 10, M = 400005;
int n, m, f[M][N][N];
vector<int> a[M];
unordered_map<ll, int> ord;
inline ll id(const vector<int> &vec){
ll res = 0;
for(int x: vec) res = res * 10 + x;
return res;
}
void init(){
vector<int> p(n);
iota(p.begin(), p.end(), 1);
int cur = 0;
do ord[id(p)] = cur;
while(cur++, next_permutation(p.begin(), p.end()));
}
void Main(){
input(n, m);
init();
for(int i = 0; i < m; i++){
a[i].resize(n);
for(int &x: a[i]) input(x);
f[ord[id(a[i])]][0][0]++;
}
vector<int> p(n);
for(int i = 0; i < n; i++) p[i] = n - i;
int cur = 1;
for(int i = 1; i <= n; i++) cur *= i;
cur--;
do{
for(int i = 0; i < n; i++){
int mx = 0, sum = f[cur][i][i];
for(int j = i + 1; j < n; j++){
if(p[i] > p[j] && p[j] > mx){
mx = p[j];
swap(p[i], p[j]);
f[ord[id(p)]][i][j] += sum;
swap(p[i], p[j]);
}
sum += f[cur][i][j];
}
f[cur][i + 1][i + 1] += sum;
}
}while(cur--, prev_permutation(p.begin(), p.end()));
for(int i = 0; i < m; i++){
write(f[ord[id(a[i])]][n][n]);
puts("");
}
return;
}
} // namespace Main
int main(){
#ifdef Liuxizai
freopen("in", "r", stdin);
freopen("out", "w", stdout);
#endif // Liuxizai
Main::Main();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 4ms
memory: 7908kb
input:
7 2000 5 1 7 4 6 3 2 1 4 6 3 5 2 7 1 3 4 6 2 7 5 6 3 7 1 4 5 2 7 3 6 2 4 1 5 6 7 3 4 1 2 5 6 1 2 5 7 4 3 5 1 4 3 7 6 2 5 3 4 1 2 7 6 7 1 3 4 6 5 2 7 4 6 2 5 1 3 2 6 3 4 1 7 5 5 6 3 1 2 4 7 4 1 6 7 5 3 2 2 6 1 3 7 4 5 1 6 2 3 4 5 7 4 3 1 5 2 7 6 7 3 2 5 4 6 1 2 6 7 1 5 3 4 7 6 2 4 1 5 3 5 1 7 3 6 2 4...
output:
57 658 1058 53 25 22 160 201 296 78 16 425 162 88 520 1032 615 31 110 14 136 176 3 203 52 38 523 384 491 178 531 8 84 589 22 89 58 119 468 120 20 224 311 69 6 1015 10 25 254 52 374 916 1 11 380 19 1094 550 769 56 49 357 735 319 17 31 741 26 62 158 75 147 31 311 438 136 396 83 53 37 141 99 247 837 60...
result:
ok 2000 numbers
Test #2:
score: 0
Accepted
time: 3ms
memory: 7960kb
input:
7 2000 2 1 7 5 6 4 3 4 7 3 1 6 2 5 3 6 4 5 2 1 7 6 5 2 7 3 1 4 4 7 3 5 1 6 2 1 2 4 5 6 3 7 5 1 3 4 7 2 6 5 6 4 2 1 7 3 7 6 3 1 4 2 5 6 7 1 2 3 5 4 2 7 3 5 6 4 1 1 4 5 2 6 3 7 6 7 1 5 3 4 2 4 1 7 6 3 2 5 2 6 7 4 5 3 1 5 7 3 6 4 2 1 4 5 2 6 1 7 3 4 2 3 1 6 7 5 7 5 3 1 2 4 6 3 1 7 6 5 2 4 3 4 5 1 2 7 6...
output:
217 108 128 29 50 1436 449 49 20 81 50 1085 18 195 21 2 197 620 42 176 522 456 30 11 43 144 90 462 1226 135 19 47 86 9 274 294 299 111 255 169 86 132 313 117 25 175 1 720 201 202 49 41 590 457 112 455 19 10 9 644 42 1382 945 308 11 71 26 109 205 16 37 7 99 190 251 79 50 723 28 62 44 50 173 220 730 6...
result:
ok 2000 numbers
Test #3:
score: 0
Accepted
time: 0ms
memory: 8036kb
input:
7 2000 3 2 7 6 4 5 1 6 1 2 7 3 4 5 7 2 4 6 3 5 1 3 1 2 7 4 5 6 6 7 2 1 5 3 4 1 4 5 2 6 7 3 1 3 4 7 5 2 6 7 2 3 6 4 5 1 7 3 2 4 1 5 6 5 3 7 2 6 4 1 3 4 6 7 2 1 5 3 1 6 5 4 2 7 3 5 6 7 1 2 4 4 7 2 5 6 3 1 7 1 5 3 4 6 2 2 6 4 5 7 3 1 3 2 6 4 7 5 1 4 3 5 6 2 7 1 2 5 4 1 3 6 7 6 5 7 1 3 4 2 6 7 5 4 1 2 3...
output:
70 284 26 876 48 695 706 31 100 38 117 646 116 28 69 74 149 81 824 28 8 68 123 126 351 185 338 44 87 49 854 840 149 622 155 46 80 1643 146 45 285 206 21 27 1084 13 720 1583 60 51 88 136 999 39 434 17 64 140 251 8 24 1243 157 70 61 180 140 648 116 155 749 338 272 5 630 1158 122 60 186 80 91 458 206 2...
result:
ok 2000 numbers
Test #4:
score: 0
Accepted
time: 3ms
memory: 5860kb
input:
7 2000 7 1 5 4 6 3 2 7 2 5 4 1 6 3 1 7 3 4 2 5 6 5 6 4 3 1 7 2 6 1 7 3 4 2 5 3 2 6 7 5 1 4 6 7 2 5 1 4 3 6 5 3 7 2 1 4 6 3 7 4 2 5 1 3 1 6 2 4 7 5 4 2 6 5 3 1 7 7 2 1 3 6 4 5 5 3 6 2 4 1 7 4 2 5 1 6 3 7 1 2 3 4 7 5 6 1 5 6 7 2 3 4 6 3 2 7 5 1 4 2 6 7 1 4 5 3 2 1 7 5 3 6 4 1 3 6 5 2 4 7 6 7 2 1 4 5 3...
output:
26 54 435 38 141 148 24 26 20 815 243 153 126 611 1432 217 68 161 453 934 46 289 1315 719 389 145 827 89 890 457 16 82 143 156 316 215 11 122 155 49 885 402 1171 103 47 851 336 1434 49 104 38 628 197 240 27 1021 280 77 207 702 194 33 494 75 1 72 274 140 79 200 845 38 528 1298 163 126 546 278 44 470 ...
result:
ok 2000 numbers
Subtask #2:
score: 22
Accepted
Dependency #1:
100%
Accepted
Test #5:
score: 22
Accepted
time: 108ms
memory: 44384kb
input:
8 300000 8 4 1 2 5 6 3 7 7 1 4 3 5 2 8 6 4 3 8 5 7 2 6 1 8 7 2 1 3 5 4 6 1 6 8 5 4 7 2 3 8 4 6 7 3 1 2 5 4 2 5 7 1 3 6 8 8 4 7 2 1 6 3 5 6 8 1 3 2 4 7 5 6 5 2 3 4 8 7 1 6 3 5 2 8 4 1 7 2 6 7 5 4 3 1 8 8 4 2 3 7 5 1 6 4 2 7 5 3 1 6 8 7 8 2 6 1 3 4 5 4 5 6 3 1 8 7 2 5 2 3 6 4 8 1 7 8 2 7 4 6 3 5 1 7 6...
output:
17022 43694 3691 4207 8987 1024 79547 3045 16830 7169 14418 14518 4895 51555 2871 14421 35694 856 807 58933 2373 4715 27147 10520 39295 26619 35845 23968 11140 5850 14445 4773 25178 2790 39377 7005 11113 34060 15968 1046 5305 2542 33276 22485 35186 7966 141907 4843 9905 2144 56198 7434 2000 36936 57...
result:
ok 300000 numbers
Test #6:
score: 0
Accepted
time: 118ms
memory: 44368kb
input:
8 300000 2 8 4 5 3 6 7 1 1 2 7 3 4 5 6 8 8 3 2 1 4 6 7 5 7 5 6 4 3 1 8 2 6 5 3 8 2 7 1 4 6 5 4 8 2 7 3 1 2 8 1 7 3 4 5 6 8 4 2 6 5 3 1 7 5 8 2 7 6 4 3 1 5 4 2 1 3 8 7 6 4 8 7 6 1 5 3 2 6 3 5 1 7 4 8 2 2 1 8 4 5 7 3 6 2 5 6 4 8 3 7 1 3 2 7 6 8 5 1 4 7 1 4 6 5 3 2 8 5 1 8 3 7 6 4 2 4 2 5 8 3 6 7 1 3 6...
output:
8490 192201 16512 1393 4879 1329 28477 4462 820 52267 913 17038 58898 12796 13187 19357 9330 13816 59641 4775 678 26768 99689 132385 22471 21878 715 20436 22107 1428 42282 138566 55387 119221 8597 1377 10083 47173 21039 245 26681 14808 9637 96932 27191 176024 14966 29734 138989 36952 17080 4429 6655...
result:
ok 300000 numbers
Test #7:
score: 0
Accepted
time: 108ms
memory: 44308kb
input:
8 300000 1 3 5 8 2 6 4 7 8 5 4 2 1 7 6 3 4 7 6 2 5 1 8 3 2 6 3 1 4 8 7 5 2 3 5 8 6 4 7 1 3 2 1 4 6 5 8 7 2 6 8 7 4 1 5 3 8 5 4 1 2 3 7 6 5 8 6 4 3 1 2 7 7 6 2 3 8 4 1 5 7 1 3 2 5 8 6 4 7 2 1 5 6 8 4 3 2 4 5 6 8 7 3 1 2 8 6 1 7 3 4 5 3 1 6 5 4 7 8 2 2 8 7 4 6 5 1 3 2 4 7 1 3 5 8 6 2 6 7 1 5 4 8 3 6 4...
output:
109610 3630 11021 84852 17152 169142 5885 7322 2122 4377 34617 14828 8843 14977 53878 2111 103839 31526 839 6430 123786 2354 14479 796 8901 6611 2196 1666 8586 27799 18167 7466 3400 109958 19367 33765 105415 161262 855 4370 7200 58816 7368 2135 71398 3718 94515 1770 17233 2966 73906 14825 7959 22106...
result:
ok 300000 numbers
Test #8:
score: 0
Accepted
time: 105ms
memory: 42524kb
input:
8 300000 5 2 7 1 6 8 3 4 2 5 1 6 8 7 3 4 2 3 5 1 8 6 7 4 5 6 4 1 2 3 7 8 1 7 5 4 3 2 8 6 1 4 3 7 5 8 2 6 3 4 1 7 5 2 8 6 2 1 8 3 5 6 4 7 2 4 1 5 3 6 8 7 8 7 1 2 6 3 5 4 2 7 3 4 6 8 1 5 6 2 3 7 1 4 8 5 5 8 2 3 7 6 1 4 4 6 1 7 2 5 3 8 4 7 2 5 6 8 1 3 6 2 3 4 5 8 1 7 7 5 1 3 2 6 8 4 8 4 3 1 5 2 7 6 2 1...
output:
28962 43580 74650 32444 56375 86881 94357 87813 183529 2085 25836 41812 5402 56726 10099 28589 20456 11506 130090 13239 15185 29208 60951 15002 357 10533 16014 3933 40802 21585 13795 22384 820 108123 25752 2093 9056 12805 6467 15914 8653 43542 6910 3209 2103 47948 80638 30148 5631 21606 26259 9996 4...
result:
ok 300000 numbers
Subtask #3:
score: 19
Accepted
Dependency #1:
100%
Accepted
Test #9:
score: 19
Accepted
time: 367ms
memory: 165548kb
input:
9 2000 7 1 3 2 9 6 4 8 5 5 3 1 7 9 8 4 2 6 5 3 6 8 9 4 1 7 2 5 2 4 3 7 6 1 8 9 3 8 7 1 5 4 6 9 2 4 3 7 2 5 9 6 8 1 4 1 9 5 6 7 2 3 8 6 4 9 5 7 1 8 3 2 3 6 7 2 9 4 8 1 5 1 4 9 5 2 6 8 7 3 9 7 1 4 2 6 3 8 5 3 9 7 5 4 6 8 1 2 9 6 4 7 2 8 3 1 5 1 8 9 2 3 7 4 5 6 4 5 6 8 3 7 9 2 1 7 1 9 3 6 2 4 8 5 9 4 7...
output:
258 134 30 405 83 84 176 13 84 188 34 12 7 100 12 117 5 86 51 2 572 87 15 118 500 104 152 27 37 397 49 1 42 12 3 645 54 7 6 6 3 6 478 267 231 243 246 17 2 178 91 304 77 69 25 19 35 413 52 71 163 1166 1141 8 616 206 46 21 536 18 59 37 270 1024 624 84 9 83 146 147 60 10 471 15 408 132 157 382 18 131 9...
result:
ok 2000 numbers
Test #10:
score: 0
Accepted
time: 334ms
memory: 163584kb
input:
9 2000 8 9 1 2 5 6 4 7 3 6 7 2 4 5 8 1 3 9 7 4 8 6 3 1 2 9 5 8 5 6 4 1 9 3 2 7 6 3 1 2 8 7 4 5 9 8 7 3 2 9 1 6 5 4 3 1 4 8 2 5 9 6 7 1 3 5 2 9 6 4 7 8 4 3 2 9 6 1 7 5 8 9 7 2 3 6 1 5 4 8 4 8 3 9 7 2 5 1 6 9 6 3 7 1 4 2 5 8 1 9 7 8 2 6 4 3 5 2 3 7 8 5 6 1 4 9 1 5 9 4 3 2 8 7 6 1 5 7 9 2 8 3 4 6 6 5 7...
output:
22 96 36 22 523 18 799 1013 302 28 16 30 14 290 293 194 107 74 69 601 18 5 3 82 6 366 2 59 51 91 26 172 2 21 22 217 310 2 160 29 14 160 16 380 52 14 38 89 454 2 24 27 129 2 143 747 30 46 219 33 244 2 86 150 12 65 207 692 36 160 41 27 359 37 239 141 42 10 4 9 95 2 219 2 20 103 399 292 21 55 11 24 691...
result:
ok 2000 numbers
Subtask #4:
score: 49
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #11:
score: 49
Accepted
time: 485ms
memory: 184252kb
input:
9 300000 8 4 2 3 6 1 7 5 9 1 3 2 5 9 8 7 6 4 4 8 9 7 3 5 2 6 1 9 8 2 4 5 7 6 3 1 5 7 4 6 1 3 2 8 9 4 3 8 9 2 1 7 5 6 4 9 3 5 8 6 1 2 7 4 1 8 5 6 9 2 3 7 4 9 6 7 5 3 1 8 2 3 2 8 4 5 6 1 9 7 2 7 5 6 8 1 9 3 4 9 5 1 8 6 2 3 7 4 3 8 7 9 4 6 5 2 1 5 3 1 2 6 9 7 4 8 2 8 5 6 4 7 3 9 1 5 4 9 3 6 1 7 2 8 4 7...
output:
22113 49143 356 158 19253 13512 4006 32265 1124 51212 16000 2878 276 76350 6185 10243 30447 1510 4915 60022 2013 2336 99140 313 29636 10682 7436 3342 67965 26856 5492 10613 98537 12985 460 276 11075 24667 6817 93049 21294 13001 6171 21088 15897 18498 1179 2800 1090 79446 2933 984 30467 1194 6552 900...
result:
ok 300000 numbers
Test #12:
score: 0
Accepted
time: 491ms
memory: 184508kb
input:
9 300000 3 4 8 2 7 6 9 1 5 9 3 7 5 6 4 8 2 1 7 4 6 9 1 2 3 5 8 9 7 4 2 6 1 8 5 3 9 7 2 5 6 3 8 1 4 9 6 8 4 3 7 5 1 2 4 8 5 2 9 7 6 1 3 8 5 4 6 7 9 2 1 3 8 6 7 1 5 9 3 4 2 2 6 3 9 5 8 1 4 7 8 5 4 7 9 6 2 1 3 7 2 1 3 4 9 8 6 5 6 2 9 5 3 7 4 8 1 6 5 1 7 4 3 2 8 9 6 8 4 7 2 9 1 5 3 5 6 9 3 2 4 7 8 1 7 5...
output:
16152 252 10063 1177 850 98 3147 620 724 24990 407 35402 4468 31152 2628 2893 8582 2416 575 23079 945 5739 2888 42797 3288 4627 2300 423 64716 163328 2052 2781 38635 166045 10210 34963 3904 8749 6087 5464 6402 4309 32823 84734 10128 4311 43708 15334 20657 4495 1432 21912 7222 1828 72521 12492 9582 1...
result:
ok 300000 numbers
Test #13:
score: 0
Accepted
time: 494ms
memory: 186536kb
input:
9 300000 9 3 5 7 6 8 2 4 1 4 9 3 7 1 2 5 8 6 2 6 4 1 8 3 7 9 5 6 5 1 8 4 2 9 7 3 8 6 9 1 7 5 4 3 2 2 1 7 8 9 5 4 6 3 3 9 5 2 7 6 1 8 4 6 4 5 8 1 2 9 7 3 3 1 6 5 4 8 2 7 9 2 5 8 6 4 3 7 1 9 7 4 5 3 9 6 1 8 2 9 3 2 8 5 1 4 7 6 3 7 9 1 2 6 5 4 8 6 2 1 5 8 3 4 7 9 5 7 1 8 6 4 3 2 9 1 8 9 7 6 3 4 2 5 8 2...
output:
390 13947 83908 16341 237 15397 9061 11717 128912 22154 3752 5474 25705 85381 12716 1700 11769 7004 8909 12585 714 993 3109 4660 368 108330 302 89561 2377 50039 3262 883 8107 6637 1496 17569 11120 15409 5314 4424 7546 11893 323 1419 745 7525 46888 3086 126013 100764 5738 3844 39498 110322 901 1235 2...
result:
ok 300000 numbers
Test #14:
score: 0
Accepted
time: 493ms
memory: 184452kb
input:
9 300000 9 5 6 4 1 2 3 8 7 8 7 9 1 5 6 3 4 2 2 6 1 5 3 9 7 8 4 4 9 2 6 3 7 5 8 1 7 4 1 9 8 5 3 6 2 1 8 9 7 6 3 5 4 2 6 7 5 8 4 2 3 1 9 7 4 1 8 2 9 6 3 5 8 3 1 9 6 2 4 7 5 4 1 8 5 7 3 6 9 2 8 5 3 6 4 2 7 9 1 1 4 6 3 8 2 9 5 7 9 8 1 6 5 7 2 3 4 5 2 1 4 8 9 6 3 7 9 6 3 2 5 1 4 7 8 8 7 9 1 2 4 3 6 5 6 9...
output:
3358 233 68454 4890 3620 745 1409 14294 11557 23218 2109 108853 401 53125 5785 1915 3380 119313 11214 9304 50342 6110 2582 6063 356 4519 34113 2767 16443 13497 20335 9639 4990 3025 16002 23830 6760 1210 44149 687 23348 1451 13989 17647 9358 13147 91963 3203 722 9032 15402 51766 5427 413 42285 3435 1...
result:
ok 300000 numbers
Test #15:
score: 0
Accepted
time: 482ms
memory: 184460kb
input:
9 300000 4 8 3 6 1 2 9 5 7 1 8 2 6 7 3 9 4 5 5 1 8 7 2 3 9 4 6 9 7 6 3 8 5 2 4 1 7 1 3 8 9 4 5 2 6 4 8 6 3 2 1 9 7 5 8 9 1 5 3 7 6 2 4 2 8 4 6 5 9 7 1 3 8 3 1 6 2 5 7 9 4 1 5 4 3 2 9 7 6 8 1 7 4 5 9 8 2 6 3 1 4 9 5 6 2 3 8 7 1 5 7 4 6 2 3 8 9 5 1 6 7 4 3 8 9 2 8 2 1 3 7 5 6 4 9 4 7 9 6 8 3 1 2 5 9 2...
output:
26652 34360 36692 71 12972 13862 1487 6870 23448 136840 17171 45123 92721 22867 39238 1181 14416 4616 2874 54 38086 52521 37917 6040 3875 20108 5192 1086 15214 24308 2063 9752 51408 24899 194697 3933 2391 28163 54957 2048 3812 2059 14053 167899 535 1213 600 4556 78700 37079 42159 2150 55650 14202 34...
result:
ok 300000 numbers
Test #16:
score: 0
Accepted
time: 494ms
memory: 186636kb
input:
9 300000 3 4 6 9 7 2 5 1 8 7 4 8 9 5 2 3 1 6 4 1 3 2 8 5 7 9 6 9 4 5 7 3 1 6 2 8 3 7 4 8 1 5 9 6 2 7 8 9 4 5 2 6 3 1 3 5 2 7 9 8 1 6 4 4 2 5 6 7 9 1 8 3 8 9 6 3 1 7 5 2 4 8 9 1 6 3 2 7 4 5 6 9 1 7 2 3 4 5 8 2 1 8 6 5 7 3 9 4 5 4 3 2 8 6 7 9 1 8 9 3 6 5 2 1 7 4 1 2 3 7 4 9 5 8 6 6 8 9 4 3 1 2 5 7 5 2...
output:
11218 1010 121679 2635 14491 115 17023 23446 485 2585 13143 52124 11557 823 138246 2090 40056 4101 23613 4670 1399 23496 20746 12318 9823 56165 4501 299 116528 4809 247 2590 12356 1402 12110 7898 1871 38046 56460 4100 16000 76776 2866 1244 6392 46095 4884 3362 1943 2605 24066 9992 11082 21555 65842 ...
result:
ok 300000 numbers
Test #17:
score: 0
Accepted
time: 490ms
memory: 184548kb
input:
9 300000 1 9 4 6 3 5 8 2 7 3 2 8 7 6 5 1 4 9 6 5 7 3 4 2 8 1 9 4 9 6 2 7 8 5 3 1 4 7 8 2 6 1 5 3 9 8 2 4 5 6 1 7 3 9 6 7 8 3 1 4 9 2 5 6 4 7 1 9 3 2 5 8 8 4 2 3 7 9 5 1 6 3 5 4 8 6 2 7 9 1 4 2 1 5 6 8 3 9 7 3 6 7 2 9 8 5 1 4 3 5 8 7 6 2 9 1 4 5 6 8 2 9 7 1 4 3 7 1 5 9 4 2 3 8 6 3 9 2 4 7 8 6 1 5 2 1...
output:
20937 25684 5692 840 16577 20509 5257 20436 6068 10315 118032 6099 6350 2960 21551 5451 36548 5257 8090 25704 4441 2592 22423 19964 45126 20769 84012 7290 15559 1491 3023 2590 7159 4105 39329 147816 38500 3962 2440 39402 83955 28060 19371 26479 3284 12463 2436 82911 52342 13685 1850 14271 10361 910 ...
result:
ok 300000 numbers
Test #18:
score: 0
Accepted
time: 496ms
memory: 184668kb
input:
9 300000 8 3 6 5 4 2 1 9 7 5 2 6 8 9 4 7 1 3 9 1 2 6 3 4 7 5 8 1 9 8 6 5 4 7 2 3 3 9 1 4 5 6 2 7 8 8 5 6 3 9 2 4 1 7 6 1 5 4 2 3 7 8 9 6 7 8 4 9 2 5 1 3 9 4 1 5 7 2 6 3 8 7 5 3 2 1 9 8 6 4 7 5 8 2 4 9 6 3 1 9 1 2 6 3 4 7 5 8 7 5 2 1 4 9 6 8 3 3 2 7 5 4 8 6 9 1 6 9 4 1 3 2 7 8 5 2 6 9 4 7 5 3 1 8 7 9...
output:
7056 4570 25506 1377 35578 1908 85431 660 10360 13141 941 25506 15934 22509 10199 9094 97 2063 7768 12673 5413 29818 4478 3633 16703 1285 183 12756 15824 371 3566 90221 2249 824 967 778 5580 65928 14502 705 7103 2614 1879 95 52691 34616 28499 88129 17597 6504 13921 11432 12037 1696 68681 4961 3688 1...
result:
ok 300000 numbers
Test #19:
score: 0
Accepted
time: 486ms
memory: 184344kb
input:
9 300000 5 2 8 6 9 7 4 3 1 9 2 7 4 8 3 6 1 5 2 9 8 1 4 6 3 7 5 9 5 7 1 4 2 6 8 3 8 7 9 6 3 1 4 2 5 8 9 1 2 7 6 4 5 3 5 6 9 7 8 1 2 3 4 8 2 3 6 9 5 7 4 1 3 8 7 9 2 5 1 4 6 1 8 9 2 3 5 6 7 4 2 3 9 5 4 1 8 6 7 2 6 7 8 9 3 5 4 1 4 6 5 7 9 8 2 3 1 4 9 3 2 6 5 7 8 1 5 4 3 6 7 2 1 9 8 5 9 6 1 3 7 8 4 2 9 1...
output:
1226 1461 9258 2697 189 1127 1451 2181 4303 14220 38667 1862 892 4978 21163 2815 11173 113 15558 52465 90142 65045 8741 16913 5386 19605 49472 900 16873 24616 8928 27128 12480 8501 15349 10588 38189 24117 225 7641 9178 1071 2299 1486 19687 3270 10451 31167 97 20192 5590 79886 254289 2106 38175 250 1...
result:
ok 300000 numbers
Test #20:
score: 0
Accepted
time: 478ms
memory: 184620kb
input:
9 300000 4 6 3 9 8 2 5 7 1 9 5 1 4 6 8 3 2 7 2 5 7 4 3 8 1 9 6 4 1 8 5 9 6 2 3 7 6 2 5 9 8 1 4 7 3 3 6 1 4 7 2 9 5 8 9 2 1 4 3 5 6 7 8 8 6 9 7 5 3 2 4 1 3 5 4 1 8 6 2 7 9 7 9 6 5 2 1 3 4 8 8 1 5 4 2 9 3 7 6 3 9 1 8 5 7 2 6 4 9 5 4 2 8 3 1 6 7 7 5 6 2 1 3 4 9 8 6 9 7 8 2 3 1 5 4 4 9 2 7 6 8 3 1 5 2 4...
output:
3217 3966 46240 23989 7827 97159 28777 27 86100 1278 24635 6659 2891 16800 623 3015 40079 3987 9926 129471 8018 24476 32506 28259 10060 12335 8042 6357 8942 73619 44830 8145 75566 38641 53316 4162 1555 11818 26905 104575 488 2965 3227 70108 55798 4218 38774 4199 20582 2148 2827 48912 28609 50703 129...
result:
ok 300000 numbers