QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#260394 | #7793. 雷同 | Lynkcat | 100 ✓ | 139ms | 3884kb | C++20 | 1.3kb | 2023-11-22 07:20:08 | 2023-11-22 07:20:08 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
// #define N
using namespace std;
const int N=10005,B=30;
int n,f[N],g[N],a[10005],s[N];
mt19937_64 rnd(1238123126361237);
inline int lowbit(int x)
{
if (!x) return 0;
return (x&-x);
}
void BellaKira()
{
bool bl=1;
n=100;
cin>>n;
for (int i=1;i<=n;i++)
{
cin>>a[i];
}
sort(a+1,a+n+1);
for (int i=1;i<=n;i++) s[i]=s[i-1]+a[i];
for (int i=0;i<=n;i++) f[i]=inf;
f[1]=0;
for (int i=1;i<=n;i++)
{
for (int j=0;j<=n;j++) g[j]=inf;
for (int j=1;j<=n;j++)
{
g[j-1]=min(g[j-1],f[j]+lowbit(j-1));
if (j*2<=n) f[j*2]=min(f[j*2],f[j]+s[n-i+1]);
}
for (int j=0;j<=n;j++) f[j]=g[j];
}
cout<<f[0]-(n-1)<<'\n';
}
signed main()
{
// freopen("std.out","w",stdout);
IOS;
cin.tie(0);
int T=1;
cin>>T;
while (T--)
{
BellaKira();
}
}
/*list:
1.mod 998244353 or 1e9+7 or ???
2.N
3.duipai shuju xingtai duoyidian
...
*/
详细
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 0ms
memory: 3408kb
input:
4 6 1 3 5 7 9 11 6 2 4 6 8 10 12 6 100 1000 100 10 100 10 2 114514 1919810
output:
86 103 1981 2034324
result:
ok 4 tokens
Subtask #2:
score: 15
Accepted
Dependency #1:
100%
Accepted
Test #2:
score: 15
Accepted
time: 1ms
memory: 3556kb
input:
5 12 2 4 3 2 2 3 4 2 3 2 2 1 12 3 3 3 2 3 2 3 2 1 1 2 4 12 6 2 2 2 5 4 6 1 2 8 8 6 12 1 4 2 2 1 6 7 2 4 1 7 5 12 11 1 2 6 16 16 15 8 8 16 6 12
output:
114 109 183 146 400
result:
ok 5 tokens
Test #3:
score: 0
Accepted
time: 0ms
memory: 3400kb
input:
5 12 4 2 4 3 2 4 4 4 3 1 1 1 12 3 4 6 5 2 3 2 5 1 3 4 4 12 3 6 4 3 5 2 5 2 5 2 3 1 12 1 2 2 3 7 7 6 4 1 2 9 3 12 12 5 12 4 3 9 3 14 5 11 6 6
output:
120 154 150 162 316
result:
ok 5 tokens
Test #4:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
5 12 3 1 2 1 2 3 1 1 1 2 1 3 12 4 7 7 6 6 2 3 7 1 7 6 6 12 13 7 13 7 9 1 5 13 3 13 9 7 12 12 12 15 13 15 22 33 33 21 9 15 3 12 123141171 193440418 455041175 665153544 746164805 372591232 659412139 493891488 760749047 4896558 90497398 964891156
output:
80 223 349 708 18084123310
result:
ok 5 tokens
Test #5:
score: 0
Accepted
time: 0ms
memory: 3380kb
input:
5 12 2 4 3 2 5 1 6 2 5 2 1 4 12 2 6 6 6 12 8 8 6 12 6 10 11 12 23 26 26 31 13 20 13 31 2 1 15 30 12 56 33 66 31 27 64 26 2 48 55 46 66 12 113216 35921 62630 73720 41172 102245 41642 39101 40760 105980 2857 63443
output:
133 335 782 1809 2470930
result:
ok 5 tokens
Subtask #3:
score: 15
Accepted
Dependency #2:
100%
Accepted
Test #6:
score: 15
Accepted
time: 0ms
memory: 3456kb
input:
5 30 34 3 20 7 6 9 22 3 24 2 3 40 25 9 6 4 3 36 5 38 21 9 5 4 21 6 28 32 17 3 30 1 6 9 2 6 9 7 2 2 4 3 5 6 8 9 7 2 7 12 7 8 4 9 8 2 8 2 12 3 2 30 4 1 1 4 4 1 3 4 3 2 4 4 1 1 2 3 3 3 2 1 2 4 4 3 3 4 4 4 3 1 30 9 6 9 8 3 10 10 1 6 1 1 6 6 10 4 9 1 4 1 6 1 10 4 9 10 7 5 2 9 8 28 7 9 6 3 5 5 1 10 9 3 1 ...
output:
2019 846 434 854 680
result:
ok 5 tokens
Test #7:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
5 28 664 896 780 167 247 381 757 743 161 986 615 182 770 358 39 563 877 325 744 45 81 634 273 657 775 545 518 581 28 9 12 3 9 11 3 5 5 5 2 1 4 10 14 10 11 9 10 4 4 5 2 4 10 13 11 14 1 29 7 7 2 5 5 2 1 9 2 5 2 1 10 4 6 9 3 10 3 10 2 9 8 5 8 6 6 10 2 28 2 4 13 10 8 13 2 2 3 10 6 3 3 9 9 11 13 8 9 1 4 ...
output:
65952 952 770 957 924
result:
ok 5 tokens
Test #8:
score: 0
Accepted
time: 0ms
memory: 3456kb
input:
5 30 10 10 16 8 9 4 3 4 9 12 8 12 9 4 8 2 8 2 3 12 4 2 2 6 15 4 1 11 5 10 28 6 7 9 10 8 8 5 7 8 1 6 2 8 8 2 3 2 7 3 10 1 9 3 5 4 3 3 6 28 23 9 28 14 27 26 22 15 7 14 7 6 16 10 10 12 5 30 8 18 21 27 29 24 5 26 4 19 28 8 8 5 2 4 6 4 1 3 5 7 2 6 2 1 6 2 6 5 3 6 6 1 3 3 1 2 8 29 36 2 8 30 35 40 18 11 32...
output:
1033 744 2170 565 2501
result:
ok 5 tokens
Test #9:
score: 0
Accepted
time: 0ms
memory: 3412kb
input:
5 28 13 5 5 8 7 12 1 10 7 1 5 6 11 15 11 7 7 1 2 11 3 2 7 8 13 14 1 15 28 1 2 4 2 1 7 2 5 1 3 7 4 1 7 7 5 1 1 7 4 4 5 5 2 7 2 4 1 30 3 4 2 4 1 3 2 1 3 2 3 4 4 1 2 1 2 4 4 4 3 3 1 3 2 3 1 4 3 1 28 3 8 16 13 15 16 5 6 3 1 13 10 11 4 9 11 15 1 14 3 5 13 14 12 7 5 16 8 30 10 10 8 9 2 9 2 5 8 6 5 2 3 7 6...
output:
972 494 409 1213 935
result:
ok 5 tokens
Test #10:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
5 28 4 6 13 13 7 10 13 6 9 3 4 10 13 1 7 12 6 13 6 9 7 5 13 2 10 8 12 8 29 42 25 50 29 24 64 64 30 21 51 34 51 20 4 38 67 33 55 19 45 52 69 8 12 14 17 5 30 5 29 4 10 2 5 1 6 2 5 9 1 7 7 5 4 8 8 1 4 5 2 10 8 10 7 1 7 5 2 4 29 854978 708926 500032 292042 541407 823656 331851 123020 599776 747561 75751...
output:
1106 4545 728 70266408 1015
result:
ok 5 tokens
Test #11:
score: 0
Accepted
time: 0ms
memory: 3412kb
input:
5 28 26 6 15 16 29 17 32 19 34 3 26 7 10 39 17 23 3 29 30 35 23 18 12 1 2 31 40 19 30 505295 277474 390487 124003 390622 385075 371433 197808 127611 94004 557282 945059 68363 945314 858030 203862 175405 98345 643502 456777 862648 932905 892097 729809 857932 391013 183944 66461 887930 680192 30 5 12 ...
output:
2588 65787788 1244 378 77639
result:
ok 5 tokens
Test #12:
score: 0
Accepted
time: 0ms
memory: 3412kb
input:
5 30 3 4 4 5 13 4 1 4 2 2 4 7 13 2 6 3 15 6 4 19 3 10 26 1 5 6 4 3 13 1 30 4 22 7 3 3 17 1 3 2 1 4 16 4 8 3 4 3 13 3 7 19 8 1 30 9 3 2 13 14 7 30 4 14 16 8 15 24 6 26 2 8 1 2 29 15 23 3 8 15 21 6 2 13 3 15 3 2 3 13 6 1 30 15 2 2 11 1 27 1 10 8 3 8 12 7 2 8 11 4 11 4 14 3 1 9 8 2 25 7 1 1 4 30 2 7 1 ...
output:
895 1066 1410 1014 1091
result:
ok 5 tokens
Test #13:
score: 0
Accepted
time: 0ms
memory: 3400kb
input:
5 30 12 2 2 5 16 4 14 15 4 11 7 15 3 10 12 6 3 10 11 9 6 3 10 10 13 3 6 2 5 2 30 7 13 4 4 7 11 4 11 14 9 13 7 5 2 10 9 5 7 1 4 14 10 9 6 3 8 5 16 7 10 30 17 2 7 8 2 12 16 13 10 7 5 14 17 5 12 12 13 7 2 3 16 2 5 5 8 14 16 1 6 9 30 16 3 1 5 1 3 12 2 8 3 2 1 12 15 17 5 14 12 6 10 3 2 4 10 2 5 13 15 16 ...
output:
1117 1152 1277 1018 1479
result:
ok 5 tokens
Test #14:
score: 0
Accepted
time: 0ms
memory: 3312kb
input:
5 30 6 2 30 1 4 1 2 4 1 4 5 11 1 6 33 1 30 17 4 5 14 4 28 1 2 6 2 18 24 13 30 9 53 2 54 21 3 3 2 2 2 2 4 7 5 3 20 4 12 1 10 4 4 2 4 25 16 14 1 54 2 30 16 13 6 10 16 4 5 16 1 5 2 20 36 2 4 21 2 13 3 21 13 26 1 32 1 45 6 6 2 27 30 58 4 29 19 15 32 4 1 16 3 17 39 8 20 4 3 24 1 2 59 10 2 4 41 28 8 43 2 ...
output:
1207 1415 1666 2261 1427
result:
ok 5 tokens
Test #15:
score: 0
Accepted
time: 0ms
memory: 3376kb
input:
5 30 5 3 6 3 3 16 1 210 5 5 2 888 352 8 45 38 150 170 2 163 956 2 682 1 56 763 1 8 18 19 30 1 8 8 1 16 226 2 25 471 2 4 27 343 1 146 188 45 24 206 241 4 136 3 4 9 3 32 15 8 20 30 648 4 274 16 933 36 14 282 7 51 7 785 3 98 29 16 3 4 54 1 4 3 19 2 12 16 10 97 10 1 30 2 764 1 4 26 812 58 214 4 3 200 93...
output:
14767 7893 10486 21657 13691
result:
ok 5 tokens
Test #16:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
5 30 52 205 5 48 13 279 1345 16 157 128 16 64 2950 34 24 371 1359 13 15 4027 288 16 39 3920 9 1862 10 7 3928 39 30 2 221 3815 48 16 2236 1869 904 212 172 41 3240 10 44 7 192 106 6 36 224 1281 191 29 9 769 16 3612 195 1732 8 30 190 3625 731 1337 47 9 735 12 17 12 265 53 7 46 39 391 16 2366 21 839 32 ...
output:
68825 74589 42013 24627 53854
result:
ok 5 tokens
Subtask #4:
score: 15
Accepted
Dependency #3:
100%
Accepted
Test #17:
score: 15
Accepted
time: 0ms
memory: 3548kb
input:
5 80 253 213 187 660 251 1090 504 964 64 3 3010 2082 157 88 1905 7 191 134 65 412 9 1 228 1260 45 3692 106 16 1930 39 13 9 12 62 2157 57 10 15 2971 178 10 2384 541 196 536 1 19 250 16 2973 197 3427 56 235 274 563 8 12 17 1 2922 6 140 795 14 40 92 2554 569 39 4 29 2 241 4057 50 11 250 2256 141 80 13 ...
output:
249766 208685 173768 119298 204533
result:
ok 5 tokens
Test #18:
score: 0
Accepted
time: 1ms
memory: 3464kb
input:
5 78 2 118 168 4 64 106 14 5 30 15 9 5 167 18 32 10 8 2 4 22 90 2 14 13 2 48 22 3 22 18 77 4 95 59 3 2 178 7 132 2 16 5 1 237 4 5 2 109 27 1 109 7 3 3 506 15 229 6 62 10 1 2 11 38 7 20 492 1 5 16 2 40 50 160 13 173 6 1 78 1 1 1 47 2 3 50 216 15 1 2 8 8 2 13 3 127 12 19 14 434 6 8 46 21 60 6 5 8 3 76...
output:
19620 16020 24832 11985 17081
result:
ok 5 tokens
Test #19:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
5 78 30045 14 14 4 1 137 4 17486 2 2 7 18 1 59 8 97 27 2 190 6 3 3 3 325 10678 9 1 6 3 285 14 107 27 13 12 3 18 15 240 31 31 1 13 4 16 16 13997 6 9 3 6 25 28 9 8 61 133 303 9 17210 19998 9 23 204 6 194 4 14 14 10 4 112 1 44 12 4 3 61 78 28 30 35 7 19258 3 22 2 59 23075 18 1 251 68 8 14 1 12 25 2 19 ...
output:
316267 756058 524726 127036 257259
result:
ok 5 tokens
Test #20:
score: 0
Accepted
time: 1ms
memory: 3408kb
input:
5 80 4 1 3 6 20 26 4 11 5 13 6 4 19 42 10 5 30 64 8 9 21 7 9 2 5 6 14 4 5 44 8 3 5 17 3 1 11 3 7 1 29 29 43 10 14 13 7 5 4 21 3 6 8 3 57 12 4 3 3 35 27 8 34 31 21 13 9 8 16 3 9 30 11 17 28 6 2 18 31 1 80 4 1 16 14 3 3 1 3 31 1 8 15 13 4 5 5 16 52 10 13 29 23 6 1 31 33 4 6 14 2 48 6 12 23 7 3 9 23 15...
output:
6488 5387 5038 5229 5350
result:
ok 5 tokens
Test #21:
score: 0
Accepted
time: 1ms
memory: 3420kb
input:
5 78 5 1 7 4 2 7 7 4 7 3 4 6 9 1 10 3 5 2 11 8 1 1 4 7 6 11 7 4 6 2 5 4 9 3 7 9 11 9 10 4 7 7 10 3 7 4 4 3 8 11 1 7 4 5 8 10 12 3 8 9 1 11 10 1 5 3 12 12 4 6 8 4 6 11 12 2 12 2 80 3 1 2 7 4 3 1 8 2 2 3 1 3 8 2 3 2 6 3 4 3 3 3 6 3 3 7 2 5 2 5 5 6 4 4 5 6 5 1 3 2 7 6 6 7 2 2 3 1 6 3 3 2 4 8 3 3 2 3 5 ...
output:
3063 2244 14403 7685 13983
result:
ok 5 tokens
Test #22:
score: 0
Accepted
time: 1ms
memory: 3356kb
input:
5 78 5 5 13 6 5 11 3 11 5 6 8 8 7 3 7 1 8 13 11 8 12 4 2 4 3 7 8 11 5 3 5 12 10 11 7 6 2 3 4 7 8 9 4 13 12 5 5 10 11 11 6 5 9 3 5 2 11 13 11 11 4 8 12 4 8 8 2 7 1 11 3 2 7 1 10 6 12 9 78 4 7 3 10 6 3 2 4 5 8 6 9 11 7 10 3 3 8 10 5 8 1 5 8 11 11 3 3 10 6 3 7 8 1 4 8 1 2 7 6 11 10 3 7 1 6 4 5 4 1 2 1 ...
output:
3514 2776 3803 1350 4708
result:
ok 5 tokens
Test #23:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
5 80 6 3 5 9 10 9 10 7 1 4 4 5 4 10 5 9 7 2 10 7 8 3 5 8 2 1 9 1 9 7 4 6 1 5 2 5 2 7 2 8 10 5 2 10 8 2 11 2 9 2 2 5 9 2 11 3 5 9 9 7 3 10 11 5 11 10 6 11 5 1 6 8 1 2 4 3 1 3 8 5 78 4 1 3 6 1 3 5 3 2 5 6 5 5 4 3 4 4 6 7 5 4 6 2 4 3 1 1 1 4 1 6 2 7 6 2 4 7 5 5 1 5 7 6 1 6 5 7 6 1 4 5 2 4 1 3 6 4 5 4 1...
output:
2959 2040 233016 4261 2612
result:
ok 5 tokens
Test #24:
score: 0
Accepted
time: 1ms
memory: 3412kb
input:
5 80 13 13 14 11 5 8 2 2 1 2 11 17 4 14 18 13 15 1 3 19 14 9 10 15 3 14 20 9 20 8 7 6 4 17 13 18 16 16 19 18 15 14 2 13 14 16 16 18 17 15 13 4 15 10 10 8 5 18 4 17 4 15 6 16 12 17 10 10 17 9 7 11 12 10 14 14 12 19 15 13 80 12 6 3 14 7 3 2 4 7 3 2 15 7 14 7 2 8 5 12 9 6 3 8 8 4 15 7 7 12 12 14 12 9 1...
output:
5882 3970 3815 2684 2895
result:
ok 5 tokens
Subtask #5:
score: 20
Accepted
Dependency #4:
100%
Accepted
Test #25:
score: 20
Accepted
time: 14ms
memory: 3576kb
input:
14000 15 4 6 7 4 4 2 4 7 7 6 2 3 7 5 1 15 3 11 12 12 13 4 2 2 9 4 1 7 10 7 4 15 2 7 4 3 7 4 3 5 8 8 5 2 6 2 1 15 12 6 6 5 12 11 5 11 11 10 8 7 12 6 8 15 2 12 13 11 4 10 8 10 6 4 9 5 10 5 5 15 2 2 4 5 7 5 3 8 4 7 2 6 1 8 8 15 4 3 3 4 1 4 4 4 3 1 3 4 4 1 2 15 2 1 1 1 6 4 1 6 4 4 1 4 5 5 7 15 7 2 5 2 5...
output:
273 379 261 520 446 280 183 200 250 367 225 321 239 161 293 175 246 860 290 177 383 229 169 640 525 891 190 401 128 504 367 158 219 208 141 500 624 326 172 352 149 198 185 189 328 235 162 318 207 167 446 325 343 177 715 399 861 329 260 221 134 317 674 279 145 462 202 242 474 220 285 463 142 174 702 ...
result:
ok 14000 tokens
Test #26:
score: 0
Accepted
time: 28ms
memory: 3380kb
input:
50000 9 5 6 2 6 1 4 6 4 3 10 1 4 1 3 2 4 1 1 3 4 10 2 1 2 2 1 2 2 1 2 1 10 7 3 10 13 13 10 2 13 9 13 10 1 2 1 1 2 1 1 1 1 2 9 2 1 3 2 2 2 1 2 1 10 26 8 11 3 12 3 2 6 28 2 10 1 7 4 4 5 5 4 8 8 3 10 1 3 2 2 3 1 1 2 3 2 10 5 2 4 4 1 5 2 2 1 4 10 6 3 6 2 4 8 7 2 5 6 9 8 13 18 5 13 18 10 18 8 9 9 9 12 11...
output:
118 81 58 301 49 54 287 164 70 100 163 351 257 138 121 73 300 52 98 103 83 60 64 199 74 41 190 589 61 391 75 285 96 39 160 45 91 68 93 137 205 324 67 64 49 130 77 91 63 221 69 120 304 69 151 159 67 321 123 114 131 147 117 126 357 258 162 166 73 472 297 652 83 78 71 203 99 140 254 97 238 73 55 49 90 ...
result:
ok 50000 tokens
Test #27:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
50 99 4 12 7 2 9 7 7 3 12 7 4 12 13 7 3 11 5 8 5 8 13 3 9 9 6 4 4 9 7 10 4 12 8 12 5 3 1 6 8 9 5 4 10 9 7 10 1 5 2 2 10 7 1 13 7 1 4 8 8 11 12 2 1 1 3 7 10 13 9 4 3 6 11 11 4 13 12 2 11 2 10 2 10 11 6 1 6 2 1 4 4 13 7 6 6 12 7 13 9 99 5 10 10 2 11 18 2 19 14 20 1 2 1 6 14 7 19 5 16 3 12 20 20 15 17 ...
output:
4562 7172 4856 3397 7724 4393 6765 12283 6363 10915 4742 6398 3454 6171 3512 3916 3678 6467 4834 3516 4705 4039 4333 5990 18699 3382 4833 4557 3871 12541 6963 5442 18101 6849 4441 3940 5386 4048 3752 5027 6947 4898 3531 6755 4697 4748 4083 6187 5117 4917
result:
ok 50 tokens
Test #28:
score: 0
Accepted
time: 1ms
memory: 3424kb
input:
50 100 4 1 4 3 10 3 5 7 6 5 9 4 6 8 5 10 10 1 2 9 2 2 9 4 6 6 1 9 3 2 5 9 9 8 2 3 3 3 2 3 6 9 8 6 6 6 10 9 10 3 8 9 8 7 10 3 8 1 4 10 8 1 10 6 3 8 9 2 10 5 5 3 1 10 10 7 8 7 6 4 4 7 8 9 5 7 7 2 4 3 9 10 7 1 9 6 4 4 9 5 100 9 8 5 9 7 6 9 2 3 11 2 10 8 6 13 11 4 13 2 2 13 14 14 14 12 12 4 13 10 5 10 5...
output:
4000 5416 7762 31260 6491 4491 20398 6532 3771 8940 5533 9025 3846 4710 3374 8975 3071 4757 2969 6857 3645 5876 5859 8960 6869 3700 20068 3912 4118 3316 5862 11428 2943 4239 3641 20067 5902 5256 8118 5730 3515 3503 4948 10739 5592 8419 7922 13046 10542 31825
result:
ok 50 tokens
Test #29:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
1 350 242 171 112 259 294 204 206 225 191 36 292 300 210 14 12 129 298 297 178 273 247 48 241 297 143 202 96 6 227 163 55 61 22 265 121 61 285 247 63 19 12 104 258 63 256 109 92 42 204 259 53 181 211 198 188 278 178 218 265 257 205 271 194 249 219 76 29 70 182 49 177 109 94 87 158 173 92 262 116 156...
output:
448422
result:
ok "448422"
Test #30:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
1 350 22 25 36 40 36 49 38 46 23 48 16 8 28 26 1 14 45 5 15 42 10 3 28 5 25 19 20 40 24 37 10 4 13 2 47 11 27 14 25 7 38 14 32 11 33 21 15 46 14 2 50 19 34 27 1 20 2 31 13 44 37 39 6 25 14 45 25 15 24 14 7 28 40 8 35 48 48 12 15 39 39 35 1 9 15 10 4 44 36 47 24 45 19 44 43 33 31 2 39 40 25 30 33 5 5...
output:
71265
result:
ok "71265"
Test #31:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
1 350 5 4 1 3 2 7 9 8 6 7 5 9 7 4 1 4 1 1 4 4 3 4 2 5 8 6 5 7 10 6 9 5 7 7 1 4 6 5 1 8 2 4 2 5 9 3 4 2 9 8 1 7 6 10 6 8 9 1 7 8 9 10 2 2 6 5 3 8 6 1 8 6 6 9 4 9 9 1 1 7 2 8 3 3 8 10 9 5 7 6 10 2 4 10 10 5 9 3 2 2 6 6 2 1 2 7 1 3 9 9 8 5 10 5 9 10 8 10 4 5 9 3 8 9 1 8 3 2 4 4 3 7 2 9 10 10 2 9 3 5 8 ...
output:
16837
result:
ok "16837"
Test #32:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
1 350 38614 17857 52769 12727 86680 41686 99669 37460 10081 84089 90803 74668 70956 31845 316 58644 64090 54920 36244 99930 76844 93653 91952 51064 52228 40301 36993 37632 66804 87914 18022 22628 16170 34237 66032 12838 46053 70832 96244 66802 87848 62222 83348 66078 64866 51682 15234 50196 4854 220...
output:
143974401
result:
ok "143974401"
Test #33:
score: 0
Accepted
time: 2ms
memory: 3420kb
input:
95 80 169 10 37 8 75 5 35 7 6 1 1 10 4 8 1 6 3 20 151 4 1 6 8 6 8 9 23 30 25 2 5 7 1 5 10 2 25 22 12 1 12 8 9 10 18 43 120 52 47 8 6 6 30 1 12 32 16 22 116 2 12 21 10 3 32 2 2 16 27 20 149 1 4 1 2 15 1 7 134 105 80 1 35 4 31 17 2 26 60 12 7 31 4 11 6 1 151 1 9 1 3 6 1 9 3 23 16 1 1 1 19 4 29 9 12 20...
output:
10024 7691 10048 10984 12610 8113 9528 10590 8330 8292 11875 10465 9639 10968 13016 8280 8526 9583 10632 15990 7349 10707 11024 10251 8395 8812 8876 8011 12232 8942 12326 9996 8522 9368 14810 9710 7448 11204 10607 9937 9392 10298 6780 10662 9617 10774 9338 10588 11147 11874 9888 10426 8670 10952 124...
result:
ok 95 tokens
Test #34:
score: 0
Accepted
time: 1ms
memory: 3404kb
input:
50 100 444 11 5 69 3 25 5 3 104 12 8 32 1 13345572 110 385 6 4 1 3 107 1341 1 10 3750172 22 2 15 1 20 5 7 16516833 24 4040407 24670210 167 631 15 15 30 20 168 29 6 317 28 5 11 8 2 28 1 12 23 8195690 19 169 39 15 8 4 15 1445 14 1123 2 15 3 88 128 4 4 14 3 1687 115 15 796 1 5 25 3 14 5 33326580 6 4 12...
output:
264663859 105074389 44996907 62454933 131254427 159807262 63931374 201384002 25017607 39536 71713638 72214304 227124459 113527085 18394733 2650441 25429405 90210227 163712612 23463 58057 273127234 125571460 23719 31721152 30973 67248145 137990652 85771988 76769058 41783522 32294903 191579606 2104076...
result:
ok 50 tokens
Test #35:
score: 0
Accepted
time: 1ms
memory: 3476kb
input:
1 350 23 2 3 32 20 24 6 31 11 52 3 5 8 2 9 7 19 9 1 9 21 4 25 11 22 5 18 1 7 36 8 10 4 2 1 84 30 4 1 2 39 14 14 30 1 3 8 1 7 7 12 26 60 24 9 8 2 11 4 6 11 1 27 4 30 45 8 4 59 5 5 13 18 3 28 23 30 6 11 12 60 30 13 19 9 2 10 5 4 1 14 3 16 2 14 11 4 22 1 1 185 2 8 2 27 1 1 7 4 28 3 1 13 2 2 4 8 13 32 1...
output:
41863
result:
ok "41863"
Test #36:
score: 0
Accepted
time: 1ms
memory: 3428kb
input:
1 350 1 1 7 20 7 8 4 4 5 13 1 3 6 20 51 2 11 40 56 2 1 2 24 21 64 4 2 2 7 52 3 46 7 7 2 2 5 30 1 15 4 6 10 8 3 2 11 8 19 86 2 17 2 2 14 2 3 7 2 1 122 3 5 127 3 25 6 15 50 6 9 3 29 125 8 19 3 4 3 8 2 2 1 3 4 76 20 122 53 50 13 3 6 64 2 11 116 2 4 87 4 3 3 8 4 31 12 4 1 2 18 15 8 2 4 6 3 2 5 4 2 2 8 2...
output:
38039
result:
ok "38039"
Test #37:
score: 0
Accepted
time: 1ms
memory: 3424kb
input:
1 350 4 38 2 5 11 2 73 89 4 122 1 1 2 14 72 61 5 7 10 8 11 16 100 128 42 5 4 43 13 215 1 8 12 14 5 29 9 134 6 10 4 2 15 5 9 2 95 1 2 6 18 13 4 32 34 11 34 1 32 7 83 3 7 225 1 6 60 2 2 3 4 2 29 7 31 9 31 4 5 37 13 4 1 39 13 31 2 1 1 50 3 45 1 60 5 41 56 12 4 1 2 101 116 2 3 12 21 7 97 22 41 11 5 2 10...
output:
58211
result:
ok "58211"
Test #38:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
1 350 12 40 2 29 18 23 73 2 4 1 22 7 3 2 3 8 109 30 2 11 65 4 6 8 3 1 4 114514 7 37 8 12 3 11 4 63 9 7 3 3 1 3 2 3 3 1 2 8 112 2 1 3 1 4 8 1 5 4 5 2 1 2 4 4 12 2 1 1 4 1 6 1 1 3 35 12 1 4 1 111 55 13 2 1 18 13 2 32 17 22 55 3 2 5 8 2 6 3 1 3 3 17 31 35 8 14 94 25 14 1 1 3 4 67 3 1 25 3 2 55 33 56 4 ...
output:
159285
result:
ok "159285"
Subtask #6:
score: 5
Accepted
Test #39:
score: 5
Accepted
time: 11ms
memory: 3664kb
input:
2 2500 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...
output:
96493 37354253753
result:
ok 2 tokens
Subtask #7:
score: 25
Accepted
Dependency #5:
100%
Accepted
Dependency #6:
100%
Accepted
Test #40:
score: 25
Accepted
time: 128ms
memory: 3704kb
input:
1 10000 1 1 212 1 416 4 2 2 18 1 15 15 2 1 2 7 1 588 2 68 8 38 2 4 2 64 5 101 2 2 4 40 133 3 4 15 3 9 5 57 10 2 12 168 22 14 109 2 7 1 4 27 64 4 39 163 52 2 24 81 16 8 1 2 2 168 110 922 4 2 417 3 15 1 4 1 16 58 2 909 18 1 6 1 4 123 9 3 6 4 7 1 3 8 179 43 1 11 8 2 179 2 6 2 5 561 1 622 3 3 52 1 7 869...
output:
9073739
result:
ok "9073739"
Test #41:
score: 0
Accepted
time: 128ms
memory: 3708kb
input:
1 10000 1 12281 71 1024 1 1 7 3 257 3 38 1803 1 12 1 7529 4 268 3 907 66 8 26 5 118 1512 913 1852 26545 918 1 4 4645 4369 1 1 4927 2 16 5 19069 71 3 677 21880 1722 3189 12 599 4169 1 5469 482 2 8 1692 4 32 3 5 4 212 702 787 986 1 2 220 1 217 5 647 2495 48 24 7 4 12 3 2 17 5361 1 8 5 2 1 2 4202 2 2 6...
output:
198082285
result:
ok "198082285"
Test #42:
score: 0
Accepted
time: 130ms
memory: 3620kb
input:
1 10000 23 20 9 3 15 17 15 12 29 24 27 7 11 28 15 12 13 14 18 9 20 17 11 24 31 28 28 28 24 11 20 8 20 24 5 1 21 8 19 16 12 1 8 14 16 21 5 27 9 10 14 23 4 29 15 24 1 18 7 5 10 15 25 12 28 1 28 26 29 32 29 27 26 10 5 6 6 21 29 23 1 14 17 31 16 11 26 23 30 32 14 19 32 20 14 6 5 8 29 31 24 28 5 15 27 13...
output:
2175103
result:
ok "2175103"
Test #43:
score: 0
Accepted
time: 129ms
memory: 3664kb
input:
1 10000 548 113 180 844 746 623 334 196 788 301 765 221 23 522 343 744 923 561 622 814 467 393 238 413 849 552 812 167 773 134 602 613 813 679 707 233 629 464 895 695 362 450 545 368 291 900 642 739 784 789 438 217 698 216 285 860 416 400 127 242 685 477 122 855 1020 204 110 184 532 1004 721 639 579...
output:
67255026
result:
ok "67255026"
Test #44:
score: 0
Accepted
time: 129ms
memory: 3692kb
input:
1 10000 24555 15575 6047 24283 16227 11177 23436 6722 14601 12588 2633 12970 24846 3032 26345 21978 32160 6652 30570 29789 7287 23386 18348 20888 31147 1469 13084 14018 13601 6651 3751 22541 7999 29175 15215 30033 31017 32018 5570 23568 27497 17040 26586 31965 26845 29703 9112 8562 20341 6347 10754 ...
output:
2117973563
result:
ok "2117973563"
Test #45:
score: 0
Accepted
time: 129ms
memory: 3844kb
input:
1 10000 4909 8040 397 12267 15932 99 1132 25698 1893 2132 19780 20984 13418 67283 3434 1056 13779 6510 1802 71244 7140 5887 29866 230 12363 3931 21902 16665 7671 16532 5360 4116 5858 27055 3502 3901 17675 7534 3314 3976 11996 20358 70743 10225 3925 57 8170 4155 44273 12987 998 3650 31310 20313 26040...
output:
2652621354
result:
ok "2652621354"
Test #46:
score: 0
Accepted
time: 126ms
memory: 3688kb
input:
1 10000 906 3 3 4 243 6 7 54 17 8 2 1 3 155 12 11 29 3 1 21 95 435 790 9 438 27 13 1 800 42 6 233 877 202 1 5 94 3 4 11 8 9 166 12 30 974 7 774 4 14 3 36 370 936 774 16 3 3 20 109 352 3 588 17 17 653 520 211 38 24 204 4 247 81 1014 16 3 82 12 28 761 22 40 115 2 489 652 4 11 595 13 4 737 955 100 148 ...
output:
16285063
result:
ok "16285063"
Test #47:
score: 0
Accepted
time: 128ms
memory: 3676kb
input:
1 10000 8 1 6 7 6 2 3 5 3 4 2 5 1 5 5 3 6 6 5 5 2 5 5 2 5 7 8 2 7 5 4 8 7 1 3 4 7 3 3 6 1 4 7 5 5 2 6 7 1 7 7 3 6 7 8 3 4 6 5 4 2 8 6 1 6 3 1 1 6 7 5 8 4 4 7 8 2 7 3 3 5 1 6 3 8 1 3 6 2 2 1 7 7 1 4 2 5 3 2 2 5 4 3 4 5 8 2 2 1 7 6 6 6 7 1 8 2 5 5 1 4 5 7 3 4 4 2 6 1 5 1 6 1 5 4 7 8 2 1 5 4 7 5 5 6 4 ...
output:
645929
result:
ok "645929"
Test #48:
score: 0
Accepted
time: 124ms
memory: 3884kb
input:
1 10000 5 3 1 3 5 1 6 1 6 31 3 2 11 9 16 4 3 86 6 27 5 3 1 2 45 7 1 8 1 2 47 1 2 5 3 6 4 3 1 5 3 22 14 4 4 54 3 1 1 3 4 7 4 4 4 1 62 3 3 2 29 14 4 4 2 3 113 8 21 3 15 3 1 4 3 2 3 3 77 8 5 4 100 2 113 108 1 1 4 31 8 9 1 4 11 2 1 7 1 1 1 6 3 2 4 2 4 1 2 4 4 1 54 3 3 20 3 1 3 1 3 3 1 3 15 20 3 3 3 10 1...
output:
1272494
result:
ok "1272494"
Test #49:
score: 0
Accepted
time: 129ms
memory: 3680kb
input:
1 10000 28336 79873 80 62 15 5805 2 7 661 1377 717 4 9 4527 1080 28422 932 4 25 8693 1 719 255 68827 58768 170 248574 2777 65 11172 8 1 3 126170 855 43756 25 1 14 2007 102031 12 483 1545 4 2 6567 1675 30 2691 8 1761 2 68 3 24 2620 42 6 10722 67011 241 1896 8425 15 31 816 301 1460 4907 31 24 13 2 132...
output:
1567285909
result:
ok "1567285909"
Test #50:
score: 0
Accepted
time: 132ms
memory: 3740kb
input:
4 5000 94 16 1 46 5909 6128 2094 87 29 64 187 24 449 2694 17 11 12 58 1980 2 104 861 174 224 2063 190 676 1194 88 173 7648 2 5990 4180 2492 1345 3 453 940 2 55 99 7 1548 1868 475 2069 84 454 17 3 1 7568 105 55 4 38 1 27 30 3 180 1455 1 311 4021 629 60 6 1816 4 240 13 4 1 1 1 2 4 2 2 1 3159 4 864 126...
output:
32134043 32250093 32630215 32774443
result:
ok 4 tokens
Test #51:
score: 0
Accepted
time: 118ms
memory: 3448kb
input:
100 1000 344 687 4 7213 1 352 14 6665 890 23 3770 4 3 7144 4829 7 13 7 16 41 4036 248 4 2040 7713 525 189 8 16 661 30 4 2 1 1 118 21 8 2 7 26 4442 1 4 6857 6862 58 183 1 903 35 2 4 8 5 732 2 2 1 37 2843 1 25 1874 446 4 1 3 1 4 2120 1 759 30 3004 2 2731 100 133 2 2 2 2 269 2 702 93 6904 308 342 1 123...
output:
5284747 5137967 5703970 4418502 5063645 4593863 5107408 5473402 4970828 4415610 5347883 5375819 5653511 5169719 5000036 4716088 4530663 5386851 5164441 5231927 5252446 5075347 5257704 4641099 5161222 5002709 5367467 4256337 4187795 5691335 4704731 4643004 4722886 4542828 4772142 4992985 5349127 4835...
result:
ok 100 tokens
Test #52:
score: 0
Accepted
time: 117ms
memory: 3444kb
input:
100 1000 4 1 98 1 4 18 2 73 51 1 67 56 2 2 8 244 1 1 15 8 2 36 4 22 8 6 6 11 15 1 115 8 2 3 8 1 7 1 9 3 126 1 123 11 86 2 21 37 4 5 7 3 1 111 52 3 2 24 46 20 2 1 1 16 96 6 1 9 1 6 105 105 2 12 3 90 23 22 13 8 119 24 1 94 10 31 13 3 252 112 4 2 10 183 4 126 11 26 18 1 8 1 1 2 14 10 3 4 36 59 51 29 60...
output:
269233 271344 297725 270477 280079 278322 301672 279379 274670 294676 281045 319343 290987 312159 281693 288665 270424 287994 266796 283028 285073 267596 291529 303431 282991 299720 303236 264908 260159 288875 291309 290226 283829 294943 282503 278852 305160 287233 310820 274312 275280 299982 278676...
result:
ok 100 tokens
Test #53:
score: 0
Accepted
time: 120ms
memory: 3452kb
input:
100 1000 78 8 98 118 28 112 94 45 103 4 89 36 63 98 115 71 43 109 111 93 2 49 37 55 41 82 25 13 99 108 64 8 84 60 38 63 80 59 94 84 52 110 120 84 108 10 74 85 7 49 118 93 109 110 46 42 67 102 12 104 106 21 99 109 124 22 89 44 21 105 85 46 55 110 48 96 53 116 67 37 62 116 25 40 47 30 95 55 86 58 97 3...
output:
633779 617036 620227 621672 620769 628265 636391 614955 617026 622964 639818 633918 622548 628428 612931 618968 635807 618477 642236 598086 620347 612751 622081 642800 626912 641420 658341 624495 658900 613195 631889 624861 626022 634327 636503 625651 624688 643000 631907 663699 619028 610963 615859...
result:
ok 100 tokens
Test #54:
score: 0
Accepted
time: 52ms
memory: 3468kb
input:
3000 100 20 8 102 127 57 60 42 27 121 31 20 76 115 46 77 110 21 123 21 108 111 29 96 50 111 62 96 66 106 98 60 69 73 102 23 63 10 40 44 24 107 49 28 42 109 83 7 53 43 3 104 105 42 16 40 31 81 28 8 48 12 9 21 57 48 70 44 115 48 62 34 5 15 23 45 106 4 16 76 108 100 87 4 83 30 115 39 100 22 93 98 28 21...
output:
37816 40420 43026 41337 44139 40725 43565 41556 44180 38770 39344 38909 37861 41093 43422 37758 41723 40389 43269 42859 42856 42804 43654 37981 36782 42935 42382 40597 43789 39052 41818 40311 40562 41977 43230 45112 44201 41436 41571 39008 40544 38471 42408 43278 40857 44249 44676 38199 39673 39621 ...
result:
ok 3000 tokens
Test #55:
score: 0
Accepted
time: 94ms
memory: 3760kb
input:
2 6000 10509 8274 29273 5313 20370 15281 14846 4729 9888 27801 29903 9377 27640 15712 21578 9118 23285 8654 27226 5317 11390 26402 10321 22873 17258 23210 22857 24995 26688 16565 15791 16342 24393 7315 19417 19070 3554 21030 24852 14398 6675 15174 24786 30609 7392 22508 31448 10464 19777 27323 15222...
output:
1209221904 1200160976
result:
ok 2 tokens
Test #56:
score: 0
Accepted
time: 91ms
memory: 3564kb
input:
2 6000 177408 185334 134312 76189 127980 245983 53046 226609 6920 108280 87111 182386 234556 101568 44276 129941 57451 197993 96986 140196 26093 243737 64390 261698 100305 64617 166566 10060 189420 223891 45031 84461 104614 134003 138097 217124 16526 200042 129923 165769 212212 112818 12609 235637 1...
output:
9756753851 9645603767
result:
ok 2 tokens
Test #57:
score: 0
Accepted
time: 95ms
memory: 3564kb
input:
2 6000 274 659 917 757 893 919 967 935 894 741 783 722 132 51 129 856 120 139 22 989 383 197 637 589 594 375 542 833 701 723 579 368 133 999 66 542 274 638 8 297 16 846 308 767 96 371 353 309 342 522 260 555 701 143 986 265 378 559 211 600 959 593 967 216 519 621 715 604 181 638 662 535 1014 224 145...
output:
38025562 38207968
result:
ok 2 tokens
Test #58:
score: 0
Accepted
time: 139ms
memory: 3704kb
input:
1 10000 253779260 281116824 78429426 473069347 127332505 47536783 186152846 79807436 11630938 103860107 300677007 354253452 259809768 95380045 279742001 133548004 245007794 389383723 71169274 132677304 15554664 364356491 439244964 174700458 111788826 277118379 322092266 173171572 138476236 32825676 ...
output:
35119196608840
result:
ok "35119196608840"