QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#251266#6430. Monster HunterLionel_ZQYAC ✓148ms222692kbC++201.2kb2023-11-14 14:54:192023-11-14 14:54:19

Judging History

你现在查看的是最新测评结果

  • [2023-11-14 14:54:19]
  • 评测
  • 测评结果:AC
  • 用时:148ms
  • 内存:222692kb
  • [2023-11-14 14:54:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const i64 inf = 1e18;

void solve(){
    int n;
    cin>>n;
    vector<i64> hp(n+1),edge[n+1];
    for(int i=2;i<=n;i++){
        int u;
        cin>>u;
        edge[u].push_back(i);
    }
    for(int i=1;i<=n;i++){
        cin>>hp[i];
    }

    vector f(n+1,vector(n+1,vector<i64>(2,inf)));

    vector<i64> siz(n+1);
    function<void(int)> dfs=[&](int u){
        f[u][0][1]=0;
        f[u][1][0]=hp[u];
        siz[u]=1;
        for(auto x:edge[u]){
            dfs(x);
            for(int i=siz[u];i>=0;i--){
                for(int j=0;j<=siz[x];j++){
                    f[u][i+j][0]=min(f[u][i+j][0],f[u][i][0]+min(f[x][j][1],f[x][j][0]+hp[x]));
                    f[u][i+j][1]=min(f[u][i+j][1],f[u][i][1]+min(f[x][j][0],f[x][j][1]));
                }
            }
            siz[u]+=siz[x];
        }
    };
    dfs(1);

    for(int i=0;i<=n;i++){
        cout<<min(f[1][n-i][0],f[1][n-i][1])<<" \n"[i==n];
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);

    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3536kb

input:

3
5
1 2 3 4
1 2 3 4 5
9
1 2 3 4 3 4 6 6
8 4 9 4 4 5 2 4 1
12
1 2 2 4 5 3 4 3 8 10 11
9 1 3 5 10 10 7 3 7 9 4 9

output:

29 16 9 4 1 0
74 47 35 25 15 11 7 3 1 0
145 115 93 73 55 42 32 22 14 8 4 1 0

result:

ok 29 tokens

Test #2:

score: 0
Accepted
time: 2ms
memory: 3820kb

input:

179
20
1 1 1 4 5 5 7 7 9 9 11 12 13 14 5 16 17 16 19
3 9 3 2 7 7 2 8 5 7 5 4 7 4 2 4 9 2 7 9
19
1 1 3 4 3 6 7 6 6 10 10 12 13 13 12 16 16 18
8 8 3 6 10 1 1 1 2 2 3 3 3 10 5 5 7 10 5
2
1
10 4
2
1
2 7
14
1 1 3 4 4 6 4 8 9 10 11 8 13
4 4 6 6 10 8 9 5 7 1 4 7 9 8
6
1 2 3 3 5
2 7 5 6 1 6
11
1 2 3 3 5 6 6...

output:

209 182 159 137 117 99 81 65 56 47 39 32 25 19 15 11 8 6 4 2 0
178 151 129 108 89 74 64 54 44 36 29 23 18 13 10 7 5 2 1 0
18 4 0
16 2 0
172 137 111 93 78 63 49 39 31 23 16 10 5 1 0
52 33 21 9 3 1 0
109 72 53 39 29 22 16 10 5 2 1 0
105 69 47 35 25 17 12 7 3 0
156 133 113 97 82 68 56 44 33 26 19 14 10...

result:

ok 2178 tokens

Test #3:

score: 0
Accepted
time: 2ms
memory: 3604kb

input:

177
10
1 2 3 3 3 6 7 8 3
750920741 600457069 885939487 614833472 917972842 716271451 234536309 280049219 394290544 802674020
5
1 2 2 4
381361244 652246733 111336853 652733347 864548837
7
1 2 2 4 4 4
374076965 100213690 316923584 132783452 321143617 617096325 590521323
14
1 1 3 4 4 6 6 6 4 10 11 10 1...

output:

11644969567 6821338808 5469960998 4515572016 3564764256 2646791414 1844117394 1229283922 628826853 234536309 0
4943092784 2773077253 1145431444 492698097 111336853 0
4531440947 2737112778 2103265610 1466071235 823784001 365780594 100213690 0
15231373225 11922670663 9482266269 7732763282 6052396185 4...

result:

ok 2176 tokens

Test #4:

score: 0
Accepted
time: 10ms
memory: 5576kb

input:

15
97
1 2 2 4 5 2 7 8 9 10 11 11 13 14 15 16 16 16 19 19 21 21 23 24 11 26 26 28 29 30 31 31 33 34 33 36 37 36 39 40 31 42 43 44 43 46 42 48 42 50 51 52 51 54 54 50 57 58 57 28 61 62 62 64 61 66 67 67 67 70 70 72 67 74 67 76 77 61 79 80 81 82 83 82 85 85 87 88 89 88 91 88 93 82 95 96
727261601 26107...

output:

107163950031 102732928896 98999901499 95286804744 91721257442 88258895738 85278119210 82530570741 79871508580 77382736169 74969945304 72561689905 70288550600 68157169720 66078603230 64055840678 62145527840 60274097298 58428791326 56711378906 54998171184 53305415604 51640777030 50049643668 4848686165...

result:

ok 2010 tokens

Test #5:

score: 0
Accepted
time: 10ms
memory: 5660kb

input:

13
171
1 1 3 3 5 6 6 6 9 10 11 12 13 14 15 16 12 6 19 20 20 22 22 24 25 22 27 28 29 27 27 27 33 33 33 36 37 38 39 40 40 42 39 44 33 46 33 48 48 48 51 51 53 53 55 56 53 58 59 48 61 61 63 64 65 66 67 68 69 70 69 72 73 73 72 69 77 69 68 80 81 82 83 84 85 82 87 88 80 90 91 92 93 93 95 93 97 98 99 91 101...

output:

187664021257 183101322620 178652629666 174903443687 171181863321 167508022266 164048979331 160694988110 157366569229 154144572418 150953357906 147898194220 145072963639 142252129359 139436947703 136631607337 133985709265 131363892815 128765304704 126168063880 123664992681 121166439175 118792530215 1...

result:

ok 1969 tokens

Test #6:

score: 0
Accepted
time: 72ms
memory: 58280kb

input:

2
1000
1 2 3 4 5 6 6 8 8 10 11 12 13 14 12 16 17 16 19 20 19 22 22 24 25 26 24 28 29 19 31 32 33 34 35 34 34 33 32 40 41 42 43 42 4 46 47 48 49 49 48 52 53 53 55 56 56 58 58 60 61 62 60 64 65 65 65 68 68 68 71 64 73 64 75 76 77 77 64 80 81 82 81 81 85 86 85 88 88 90 88 92 92 94 95 96 97 97 99 99 101...

output:

1113237056588 1108226059331 1103452926208 1098937464290 1094424834414 1090101107734 1085979381309 1081924835645 1077939941478 1073955392448 1070060014619 1066167943999 1062419631658 1058704177859 1055039647440 1051385794327 1047741820417 1044141128405 1040544084361 1036983950782 1033443541341 102993...

result:

ok 2002 tokens

Test #7:

score: 0
Accepted
time: 127ms
memory: 222612kb

input:

1
2000
1 1 3 4 1 6 7 7 6 10 11 12 12 14 15 11 17 18 18 20 21 22 23 24 22 26 27 28 27 27 31 32 33 34 35 32 37 37 39 39 41 42 43 42 45 10 47 47 49 49 51 49 53 54 55 56 57 57 59 60 61 62 61 64 65 66 67 68 65 70 71 71 73 73 75 75 77 78 75 80 81 82 82 82 85 85 87 88 88 90 88 92 93 92 95 96 97 97 97 100 1...

output:

2218881294575 2213744695667 2209258961365 2204812368487 2200449406724 2196203533720 2192056603090 2187933211280 2183833968547 2179737242326 2175719186934 2171741657318 2167810748823 2163879903171 2159962385119 2156074431587 2152191794989 2148338662389 2144513166298 2140724085981 2136958464736 213322...

result:

ok 2001 tokens

Test #8:

score: 0
Accepted
time: 135ms
memory: 222608kb

input:

1
2000
1 1 3 4 4 4 7 8 9 8 11 12 7 14 15 16 17 17 3 20 21 20 23 24 25 25 27 25 29 29 29 23 33 23 35 35 37 38 39 39 39 42 42 39 45 35 47 47 49 49 51 52 47 54 55 55 57 58 55 60 61 60 60 60 65 66 66 68 69 70 71 69 73 73 75 76 77 76 76 80 81 81 83 83 85 86 87 87 89 90 91 91 93 89 95 80 97 98 99 100 101 ...

output:

2251617273778 2247003039440 2242430225953 2237883166436 2233355730054 2228961190864 2224718903682 2220482730939 2216287724882 2212119854387 2207975346387 2203853324653 2199734356726 2195721269018 2191711933780 2187703738249 2183801657775 2179907800916 2176038498164 2172181973574 2168329662833 216450...

result:

ok 2001 tokens

Test #9:

score: 0
Accepted
time: 116ms
memory: 222472kb

input:

1
2000
1 2 2 1 5 1 1 8 9 9 11 11 13 14 15 16 16 18 16 20 16 22 13 24 25 25 27 28 29 28 31 32 32 28 35 27 37 37 39 40 39 42 43 44 44 46 46 48 49 44 51 52 53 52 55 52 51 58 59 58 61 61 63 63 65 66 67 67 65 70 70 72 73 74 70 76 77 77 79 80 77 65 83 83 85 86 86 88 89 89 91 91 93 93 93 93 97 97 99 100 10...

output:

2206881062084 2202092706920 2197564054211 2193078757615 2188740187606 2184470790404 2180330836648 2176299098130 2172293912044 2168303008199 2164315464017 2160345496700 2156417698598 2152491863648 2148575952119 2144668178439 2140768739007 2136894877679 2133031560312 2129188280081 2125408396292 212163...

result:

ok 2001 tokens

Test #10:

score: 0
Accepted
time: 115ms
memory: 222392kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 10 13 14 14 16 17 16 19 16 13 22 22 13 10 26 27 26 29 26 26 10 33 34 33 9 37 38 39 40 38 42 43 38 45 38 47 47 37 50 51 52 53 54 53 56 53 58 59 52 61 61 63 61 65 52 67 52 69 51 71 50 73 74 74 76 74 78 37 80 81 37 83 83 37 37 37 37 37 9 91 91 93 91 95 9 8 98 99 100 101 1...

output:

2239908981975 2232517414071 2225894512841 2219372844163 2213085150127 2207519039932 2202083361540 2196758986281 2191444012176 2186229941641 2181154413896 2176085010679 2171029257148 2166029667863 2161088940966 2156306922261 2151535754361 2146791775272 2142105755058 2137465141703 2132880168320 212830...

result:

ok 2001 tokens

Test #11:

score: 0
Accepted
time: 125ms
memory: 222420kb

input:

1
2000
1 2 3 4 5 6 7 8 8 7 11 11 13 14 15 16 17 18 19 20 21 22 23 24 25 25 23 28 22 30 31 30 22 34 35 36 37 38 22 22 41 22 43 43 21 20 47 48 49 49 51 51 49 54 48 56 48 58 47 47 20 62 63 63 65 66 67 66 69 66 63 72 73 18 17 16 77 78 79 79 16 82 83 84 84 86 83 82 89 90 91 92 92 94 91 96 89 98 99 100 10...

output:

2187566746517 2182187929991 2176874744181 2172157735355 2167581858172 2163014604257 2158449355514 2153903271574 2149394732089 2144890155305 2140409630299 2135948820472 2131496356723 2127063843406 2122704497177 2118350861665 2114007171456 2109743502902 2105496707054 2101256560940 2097108029529 209296...

result:

ok 2001 tokens

Test #12:

score: 0
Accepted
time: 110ms
memory: 222608kb

input:

1
2000
1 2 3 4 4 6 7 8 9 10 11 12 12 14 15 7 6 18 19 20 21 22 23 24 23 26 27 26 26 30 31 32 33 30 30 36 26 38 39 22 41 41 43 44 45 46 47 48 49 50 50 52 52 47 55 55 45 58 45 44 61 62 61 64 64 64 43 68 69 70 71 68 73 74 74 73 77 78 77 68 68 82 82 22 85 86 87 88 87 90 91 90 93 94 94 94 97 86 99 100 101...

output:

2189791993272 2184503440761 2179558617878 2174909008068 2170291963818 2165729773866 2161186103446 2156743150210 2152327655076 2147979515403 2143644696051 2139346682030 2135121171622 2130925682410 2126769405351 2122695229538 2118629846463 2114651244627 2110684023924 2106730754655 2102782338387 209884...

result:

ok 2001 tokens

Test #13:

score: 0
Accepted
time: 117ms
memory: 222484kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 10 8 13 14 15 15 17 18 19 20 21 21 23 23 25 25 27 28 29 30 31 31 33 34 35 36 37 37 36 40 41 40 43 43 43 35 47 47 49 50 51 52 53 54 55 53 53 58 59 60 61 61 63 64 63 60 52 49 69 47 71 72 35 74 75 76 77 78 79 79 81 82 83 81 85 85 81 77 89 89 89 92 93 94 94 94 76 98 98 100 10...

output:

2220518092263 2215732319500 2210984793056 2206238533572 2201597531031 2197054470311 2192520546799 2188081300705 2183715317378 2179387838156 2175170120514 2171146207161 2167177667676 2163227064523 2159290434728 2155398316333 2151507487160 2147619095455 2143732109465 2139854894565 2136039327617 213224...

result:

ok 2001 tokens

Test #14:

score: 0
Accepted
time: 2ms
memory: 3892kb

input:

134
19
1 2 2 4 5 6 7 7 6 10 11 12 13 14 11 16 17 18
6 7 6 10 5 7 7 8 3 2 6 2 2 6 8 4 2 4 7
10
1 2 2 4 5 6 7 6 9
7 10 6 8 6 7 3 2 9 7
19
1 2 3 4 5 6 7 7 9 4 11 11 13 14 13 16 17 18
5 5 6 2 10 2 9 3 3 6 5 1 5 8 7 9 1 6 1
18
1 2 3 4 5 6 1 8 9 10 11 12 13 14 15 9 17
1 1 9 10 9 5 4 5 8 3 8 6 6 9 6 1 5 1
...

output:

198 168 143 123 105 88 73 59 51 43 36 30 24 18 13 9 6 4 2 0
123 89 63 45 33 26 19 13 7 2 0
183 156 132 110 94 79 63 50 38 30 23 18 13 10 7 5 3 2 1 0
193 164 140 116 94 72 60 50 40 31 24 18 12 8 5 3 2 1 0
96 66 44 31 21 15 9 5 3 1 0
102 67 46 34 24 14 9 5 2 1 0
119 93 71 49 33 22 14 6 4 2 1 0
175 147...

result:

ok 2127 tokens

Test #15:

score: 0
Accepted
time: 2ms
memory: 3660kb

input:

135
19
1 2 1 4 5 5 7 4 9 9 11 12 11 14 15 14 17 18
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
16
1 1 3 3 5 6 7 6 9 10 11 12 13 14 15
1...

output:

37000000000 33000000000 29000000000 25000000000 22000000000 19000000000 16000000000 14000000000 12000000000 10000000000 9000000000 8000000000 7000000000 6000000000 5000000000 4000000000 3000000000 2000000000 1000000000 0
31000000000 27000000000 23000000000 20000000000 17000000000 14000000000 1200000...

result:

ok 2134 tokens

Test #16:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

130
20
1 1 3 4 4 3 7 7 9 10 10 12 13 14 15 16 17 18 19
890245275 826949747 930998021 227159075 875688785 904342722 518026431 347758838 596601609 889934230 867009820 275688682 589383029 811978241 367558119 549938260 840229119 458907694 122945257 608340046
14
1 2 2 4 5 6 7 5 1 10 11 12 13
354616511 16...

output:

24109120725 21186553763 18538360720 16304011063 14164645131 12173130530 10192717221 8867003864 7582719668 6366039576 5207882480 4213524098 3346514278 2519564531 1922962922 1341109971 973551852 625793014 350104332 122945257 0
12079383037 9912001048 7999694706 6143099517 4542912749 3505539149 26265326...

result:

ok 2129 tokens

Test #17:

score: 0
Accepted
time: 56ms
memory: 58340kb

input:

2
1000
1 2 3 2 5 6 7 8 9 10 7 12 12 14 15 16 17 15 19 19 21 14 23 23 25 26 27 28 29 28 26 32 33 34 35 36 37 38 39 40 39 42 43 44 45 44 47 47 49 50 51 49 53 54 55 56 57 58 59 59 55 62 62 64 65 65 67 67 69 70 71 71 73 74 75 76 77 78 77 80 81 82 80 84 84 86 86 88 89 90 91 92 93 94 95 96 92 98 98 100 10...

output:

1087012935694 1083312606896 1079710047856 1076167857600 1072688415661 1069235844035 1065792043214 1062374798390 1058993816387 1055632934263 1052322356363 1049033592858 1045781646900 1042563691152 1039353881011 1036159077609 1032965722192 1029776323322 1026611904852 1023472572635 1020360346684 101730...

result:

ok 2002 tokens

Test #18:

score: 0
Accepted
time: 128ms
memory: 222612kb

input:

1
2000
1 2 3 4 2 6 6 8 9 10 10 12 13 9 15 16 16 18 19 20 21 21 23 19 25 26 27 28 28 30 31 32 33 34 35 34 31 38 38 40 41 42 40 44 44 46 46 48 49 50 50 52 53 54 55 56 53 58 59 60 61 62 59 64 65 66 64 68 69 70 71 72 73 74 75 76 76 78 79 80 81 82 83 83 85 86 87 88 89 90 88 92 92 94 81 96 97 96 99 100 10...

output:

2216928825336 2213172721244 2209515539543 2205934063386 2202388418437 2198875931031 2195363650791 2191856397793 2188350984431 2184858599496 2181383436910 2177927280009 2174520220932 2171116115080 2167730026415 2164358164229 2160991664849 2157627649373 2154266017190 2150934417303 2147608282237 214429...

result:

ok 2001 tokens

Test #19:

score: 0
Accepted
time: 127ms
memory: 222544kb

input:

1
2000
1 2 3 2 5 6 7 7 9 10 11 12 13 9 15 15 17 18 17 20 21 21 23 23 25 26 27 28 29 30 31 27 33 34 35 36 33 38 39 40 41 38 43 43 45 46 45 48 49 50 50 52 49 54 55 56 56 58 59 60 61 62 55 64 65 66 67 67 65 70 71 72 73 73 70 76 77 78 76 80 81 81 83 80 85 86 87 88 88 90 91 92 91 90 95 96 97 97 96 100 10...

output:

2201970810924 2198248960282 2194562751839 2190913120139 2187304687188 2183715159089 2180136209832 2176566818875 2172999392054 2169437433635 2165984270827 2162536679632 2159120830258 2155736816769 2152369934734 2149024739727 2145710580431 2142404599471 2139109795374 2135818074739 2132536294991 212926...

result:

ok 2001 tokens

Test #20:

score: 0
Accepted
time: 125ms
memory: 222476kb

input:

1
2000
1 1 3 4 5 3 7 8 7 10 11 10 13 13 15 16 17 18 18 17 21 22 23 24 25 26 27 28 25 22 31 32 33 34 35 32 37 38 39 40 40 42 43 44 45 46 42 48 49 50 51 50 53 54 55 56 57 58 59 60 59 62 63 62 65 66 67 68 69 70 71 72 72 69 75 76 67 78 79 80 81 82 83 84 85 81 87 88 88 90 91 90 93 94 94 96 97 98 99 98 10...

output:

2187401111668 2183689466386 2180079363220 2176507318308 2172951923069 2169427183121 2165921444226 2162442570296 2158966209869 2155508634868 2152077320540 2148647109621 2145236377450 2141851435012 2138468106791 2135118722831 2131779011606 2128467949184 2125194940343 2121936521536 2118679496928 211543...

result:

ok 2001 tokens

Test #21:

score: 0
Accepted
time: 147ms
memory: 222412kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2226121779049 2206228385594 2186717564374 2167311431007 2149006693401 2130830732579 2113751229270 2096797331130 2080184933841 2063587491238 2047228631335 2031257185636 2015287840840 1999424905363 1983705396440 1968219416965 1952806647079 1937601301970 1922417961562 1907290037416 1892177433037 187709...

result:

ok 2001 tokens

Test #22:

score: 0
Accepted
time: 123ms
memory: 222628kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2209464207001 2202295798471 2195135742059 2188003065423 2180987019303 2174084295895 2167308308316 2160583591271 2153923291837 2147596871721 2141445119821 2135335137730 2129257952268 2123257020381 2117270760269 2111367071643 2105489987994 2099625143552 2093807265178 2088105567227 2082404694611 207678...

result:

ok 2001 tokens

Test #23:

score: 0
Accepted
time: 148ms
memory: 222412kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2191361115337 2186300372333 2181320664530 2176498138366 2171758313237 2167053032616 2162389836718 2157745042922 2153229119147 2148760730857 2144392919982 2140025614387 2135673755830 2131344840744 2127030128696 2122741711820 2118458958301 2114180422639 2109904965846 2105659760388 2101466174837 209736...

result:

ok 2001 tokens

Test #24:

score: 0
Accepted
time: 108ms
memory: 222420kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2200234061076 2194286598324 2188496983300 2182830544833 2177282270715 2171741245841 2166250132149 2160759374534 2155346884945 2149964431237 2144727705295 2139597035666 2134511566957 2129525145000 2124659842765 2119823627255 2115045451101 2110284360323 2105572360895 2100901245684 2096278758424 209166...

result:

ok 2001 tokens

Test #25:

score: 0
Accepted
time: 126ms
memory: 222408kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2189518196372 2183001758211 2177669317563 2172356759949 2167047733513 2161979145764 2156992496584 2152166810550 2147372659237 2142702784059 2138057014938 2133444338772 2128866687129 2124320029523 2119799374674 2115305162892 2110897364571 2106492258479 2102132828397 2097784048981 2093440139408 208910...

result:

ok 2001 tokens

Test #26:

score: 0
Accepted
time: 145ms
memory: 222464kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2214443505186 2209389012223 2204530127971 2199837867389 2195277444101 2190753360370 2186393008026 2182082181366 2177903364528 2173736296667 2169636929841 2165547134076 2161490657099 2157447321378 2153419746333 2149424059784 2145483291773 2141626443204 2137782909540 2133941790235 2130108229567 212629...

result:

ok 2001 tokens

Test #27:

score: 0
Accepted
time: 146ms
memory: 222692kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2205408052282 2202428159092 2199464564430 2196525759113 2193596442215 2190704499827 2187815604116 2184926741214 2182039738885 2179155977228 2176276658345 2173400310019 2170526325538 2167655721789 2164805719165 2161961799231 2159122026542 2156292444210 2153474035867 2150656161462 2147843969334 214503...

result:

ok 2001 tokens

Test #28:

score: 0
Accepted
time: 131ms
memory: 222612kb

input:

1
2000
1 2 2 4 5 6 7 7 5 10 11 10 13 14 13 16 17 16 19 20 21 22 20 24 25 26 25 25 29 29 29 32 33 32 35 35 37 38 39 40 39 38 35 44 45 45 47 48 49 50 51 52 53 54 55 53 57 58 59 59 61 62 63 64 64 66 67 68 66 70 71 72 73 74 75 74 77 78 79 80 81 82 83 83 85 86 87 88 85 90 91 92 92 94 95 96 96 98 99 100 1...

output:

2162765933434 2158542822888 2154467669981 2150443202838 2146485925541 2142574396694 2138672197540 2134864693008 2131092000678 2127331883343 2123581906448 2119963701499 2116356176680 2112750931327 2109157400414 2105587577360 2102033294371 2098479389375 2094933474476 2091410727518 2087902199115 208440...

result:

ok 2001 tokens

Test #29:

score: 0
Accepted
time: 135ms
memory: 222396kb

input:

1
2000
1 2 3 1 5 5 7 8 9 7 11 11 5 14 15 5 1 18 19 20 21 22 23 23 25 26 27 28 29 30 31 32 33 31 35 36 37 31 39 29 29 42 23 44 44 46 46 22 21 50 50 52 53 53 55 56 57 58 59 60 61 61 63 64 65 66 67 68 69 70 71 71 73 74 74 76 77 78 79 77 81 82 83 84 85 74 87 88 89 90 91 92 93 94 94 96 97 97 74 100 101 1...

output:

2199868336839 2195301901458 2191038845195 2186884658491 2182804523751 2178829756745 2174869901206 2170945457624 2167029836183 2163121765047 2159280933094 2155496518038 2151736536549 2148005563891 2144288645352 2140594570148 2136973568388 2133355641250 2129743454810 2126134683836 2122528654173 211893...

result:

ok 2001 tokens

Test #30:

score: 0
Accepted
time: 117ms
memory: 222488kb

input:

1
2000
1 2 3 4 5 6 7 7 7 6 11 11 11 6 15 15 15 5 19 20 20 20 19 24 24 24 19 28 28 28 5 32 33 33 33 32 37 37 37 32 41 41 41 4 45 46 47 47 47 46 51 51 51 46 55 55 55 45 59 60 60 60 59 64 64 64 59 68 68 68 45 72 73 73 73 72 77 77 77 72 81 81 81 4 85 86 87 87 87 86 91 91 91 86 95 95 95 85 99 100 100 100...

output:

2220463353769 2215951597196 2211479570611 2207027382994 2202743405274 2198477622058 2194248890684 2190025368036 2185824499301 2181635711744 2177451161167 2173283009227 2169134890509 2164987146532 2160857395259 2156732560088 2152649988469 2148573802976 2144537516580 2140517717809 2136499544865 213249...

result:

ok 2001 tokens

Test #31:

score: 0
Accepted
time: 106ms
memory: 222476kb

input:

1
2000
1 2 3 4 5 5 5 5 5 4 11 11 11 11 11 4 17 17 17 17 17 4 23 23 23 23 23 4 29 29 29 29 29 3 35 36 36 36 36 36 35 42 42 42 42 42 35 48 48 48 48 48 35 54 54 54 54 54 35 60 60 60 60 60 3 66 67 67 67 67 67 66 73 73 73 73 73 66 79 79 79 79 79 66 85 85 85 85 85 66 91 91 91 91 91 3 97 98 98 98 98 98 97 ...

output:

2208269535286 2201965788211 2195901598301 2190229604124 2184649488162 2179137989697 2173652572269 2168179173332 2162748331593 2157344175929 2152012814201 2146730637520 2141456159679 2136182996484 2130955745539 2125735487974 2120530942766 2115366611519 2110259879509 2105161081005 2100063350152 209499...

result:

ok 2001 tokens

Test #32:

score: 0
Accepted
time: 121ms
memory: 222404kb

input:

1
2000
1 2 3 4 4 4 4 4 4 4 3 12 12 12 12 12 12 12 3 20 20 20 20 20 20 20 3 28 28 28 28 28 28 28 3 36 36 36 36 36 36 36 3 44 44 44 44 44 44 44 3 52 52 52 52 52 52 52 2 60 61 61 61 61 61 61 61 60 69 69 69 69 69 69 69 60 77 77 77 77 77 77 77 60 85 85 85 85 85 85 85 60 93 93 93 93 93 93 93 60 101 101 10...

output:

2211613093937 2203873815030 2197135664022 2190402844206 2183684810573 2177018722021 2170391914488 2163774359983 2157178275641 2150590622352 2144027020598 2137481265357 2130975419032 2124501985693 2118064876788 2111700229076 2105390706906 2099111683954 2092856084432 2086612024550 2080387049121 207418...

result:

ok 2001 tokens

Test #33:

score: 0
Accepted
time: 110ms
memory: 222416kb

input:

1
2000
1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 2 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 2 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 2 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 2 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 87 2...

output:

2196959401867 2182031264244 2167354518175 2152764273075 2138183727470 2123788982503 2109792164872 2096074387680 2082425849765 2068931851585 2055472419921 2042033879883 2028611792780 2015215613680 2001912371298 1988636902283 1975443855432 1962278793316 1949152665681 1936059338016 1922994659296 191002...

result:

ok 2001 tokens

Test #34:

score: 0
Accepted
time: 127ms
memory: 222480kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

2171630160674 2165530712974 2162556071327 2159600602377 2156646652669 2153708243975 2150802039135 2147905381985 2145016131322 2142127220622 2139244428636 2136363734936 2133485911813 2130612743596 2127747010387 2124881477461 2122026241445 2119182496792 2116340431193 2113502159317 2110670762220 210784...

result:

ok 2001 tokens

Test #35:

score: 0
Accepted
time: 131ms
memory: 222432kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 1 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101...

output:

2215940241599 2190010765248 2187047239647 2184124077088 2181206386910 2178293219747 2175384352798 2172487248664 2169599259451 2166714931562 2163832691106 2160954115304 2158091271663 2155241442460 2152394754456 2149548194450 2146717556894 2143897307485 2141096892310 2138296697532 2135498673546 213271...

result:

ok 2001 tokens

Test #36:

score: 0
Accepted
time: 139ms
memory: 222552kb

input:

1
2000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 1 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 1 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1 102...

output:

2218808669025 2159578545822 2156602623403 2153627141990 2150712155243 2147811589300 2144930742075 2142052890517 2139176889039 2136301386791 2133431975342 2130565778129 2127703605242 2124841606216 2121982256245 2119123929584 2116275107292 2113430304295 2110586528521 2107745870238 2104906006598 210206...

result:

ok 2001 tokens

Test #37:

score: 0
Accepted
time: 132ms
memory: 222492kb

input:

1
2000
1 2 3 4 1 6 7 8 1 10 11 12 1 14 15 16 1 18 19 20 1 22 23 24 1 26 27 28 1 30 31 32 1 34 35 36 1 38 39 40 1 42 43 44 1 46 47 48 1 50 51 52 1 54 55 56 1 58 59 60 1 62 63 64 1 66 67 68 1 70 71 72 1 74 75 76 1 78 79 80 1 82 83 84 1 86 87 88 1 90 91 92 1 94 95 96 1 98 99 100 1 102 103 104 1 106 107...

output:

2209574190497 1933931644830 1930994920629 1928074341500 1925157523334 1922276902938 1919399749996 1916543815821 1913692915943 1910862408568 1908042971091 1905228920202 1902421409198 1899614464723 1896810877285 1894009742256 1891226514166 1888447910846 1885672677940 1882901192651 1880138128305 187737...

result:

ok 2001 tokens

Test #38:

score: 0
Accepted
time: 123ms
memory: 222488kb

input:

1
2000
1 2 1 4 1 6 1 8 1 10 1 12 1 14 1 16 1 18 1 20 1 22 1 24 1 26 1 28 1 30 1 32 1 34 1 36 1 38 1 40 1 42 1 44 1 46 1 48 1 50 1 52 1 54 1 56 1 58 1 60 1 62 1 64 1 66 1 68 1 70 1 72 1 74 1 76 1 78 1 80 1 82 1 84 1 86 1 88 1 90 1 92 1 94 1 96 1 98 1 100 1 102 1 104 1 106 1 108 1 110 1 112 1 114 1 11...

output:

2173172493533 1624614046718 1622616800636 1620622084341 1618631413337 1616644958165 1614659559149 1612674532205 1610691771393 1608717316873 1606744179849 1604772769349 1602801918033 1600840621087 1598880672621 1596921472937 1594963177445 1593005197293 1591047741123 1589090353193 1587134426943 158517...

result:

ok 2001 tokens