QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#737835#7646. 优惠购物Zaunese40 182ms86820kbC++143.2kb2024-11-12 16:57:492024-11-12 16:57:50

Judging History

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

  • [2024-11-12 16:57:50]
  • 评测
  • 测评结果:40
  • 用时:182ms
  • 内存:86820kb
  • [2024-11-12 16:57:49]
  • 提交

answer

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>

#define fi first
#define se second
#define mkp std::make_pair
using ll=long long;
using std::min;
using std::max;
template<class T> void cmax(T&a,T b){a=max(a,b);}
template<class T> void cmin(T&a,T b){a=min(a,b);}

const int NV=1e6;

namespace xm{
    extern ll s[],x[];
}

namespace seg{
    struct SEGN{
        ll v,tad;
    } tr[NV*4+5];
    void up(int x){
        tr[x].v=min(tr[x*2].v,tr[x*2+1].v);
    }void doadd(int x,ll z){
        tr[x].v+=z;
        tr[x].tad+=z;
    }void dn(int x){
        if(tr[x].tad){
            doadd(x*2,tr[x].tad);
            doadd(x*2+1,tr[x].tad);
            tr[x].tad=0;
        }
    }void add(int x,int l,int r,int ql,int qr,ll z){
        int mid=l+r>>1;
        if(ql<=l&&r<=qr) return doadd(x,z);
        dn(x);
        if(ql<=mid) add(x*2,l,mid,ql,qr,z);
        if(mid<qr) add(x*2+1,mid+1,r,ql,qr,z);
        up(x);
    }ll que(int x,int l,int r,int ql,int qr){
        ll ans=1ll<<62;
        int mid=l+r>>1;
        if(ql<=l&&r<=qr) return tr[x].v;
        dn(x);
        if(ql<=mid) ans=que(x*2,l,mid,ql,qr);
        if(mid<qr) cmin(ans,que(x*2+1,mid+1,r,ql,qr));
        return ans;
    }void build(int x,int l,int r){
        tr[x].tad=0;
        if(l==r){
            tr[x].v=xm::s[l-1]-xm::x[l];
        }else{
            int mid=l+r>>1;
            build(x*2,l,mid);
            build(x*2+1,mid+1,r);
            up(x);
        }
    }
}

namespace xm{
    ll C,s[NV+5],x[NV+5],a[NV+5],b[NV+5],up[NV+5];
    int N,pi[NV+5];
    void _(){
        scanf("%d%lld%lld",&N,s,&C);
        for(int i=1;i<=N;++i) scanf("%lld",a+i);
        for(int i=1;i<=N;++i) scanf("%lld",b+i);
        for(int i=1;i<=N;++i){
            ll w=min({a[i]%C,b[i],s[i-1]});
            x[i]=w;
            s[i]=s[i-1]-w+(a[i]-w)/C; 
        }
        ll lim=s[N];
        for(int i=N;i;--i){
            ll w=min({(b[i]-x[i])/C,(s[i-1]-x[i])/C,lim/(C+1)});
            x[i]+=C*w;
            lim=min(lim-(C+1)*w,s[i-1]-x[i]);
        }
        for(int i=1;i<=N;++i)
            s[i]=s[i-1]-x[i]+(a[i]-x[i])/C; 
        s[N+1]=0;
        x[N+1]=pi[N+1]=0;
        seg::build(1,1,N+1);
        for(int i=1;i<=N;++i){
            pi[i]=i;
            up[i]=min(C-1,b[i]-x[i]);
        }
        std::sort(pi+1,pi+N+1,[&](int u,int v){
                return up[u]>up[v];});
        std::priority_queue<int> q;
        //for(int i=1;i<=N+1;++i) printf("%lld ",s[i]); puts("");
        //for(int i=1;i<=N+1;++i) printf("%lld ",x[i]); puts("");
        for(int i=1;i<=N;){
            int j=i;
            for(;j<=N&&up[pi[i]]==up[pi[j]];++j) q.push(pi[j]);
            while(q.size()){
                int u=q.top();
                ll z=min({up[u],seg::que(1,1,N+1,u,u),
                        seg::que(1,1,N+1,u+1,N+1)-1});
                if(z>=up[pi[i]]){
                    q.pop();
                    x[u]+=z;
                    seg::add(1,1,N+1,u,u,-z);
                    seg::add(1,1,N+1,u+1,N+1,-z-1);
                }else break;
            }
            i=j;
        }
        ll ans=0;
        for(int i=1;i<=N;++i) ans+=a[i]-x[i];
        printf("%lld\n",ans);
    }
}

int main(){
    int t;
    scanf("%d",&t);
    while(t--) xm::_();
    return 0;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 3ms
memory: 16372kb

input:

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

output:

51
42
49
48
54

result:

ok 5 lines

Test #2:

score: 5
Accepted
time: 0ms
memory: 16084kb

input:

5
10 8 16
2 4 3 3 10 1 8 7 1 10
2 1 1 2 9 0 2 2 1 0
10 6 5
1 8 7 1 5 1 2 5 5 2
1 6 0 0 4 1 0 0 0 0
10 9 9
10 5 3 1 2 1 9 3 1 10
3 0 2 0 2 1 8 2 1 9
10 4 8
1 4 7 9 2 4 7 9 4 6
1 3 2 4 1 0 4 0 4 2
10 10 7
5 1 6 4 7 5 10 6 2 7
2 0 3 4 5 4 7 4 2 1

output:

41
29
34
47
41

result:

ok 5 lines

Test #3:

score: 5
Accepted
time: 0ms
memory: 16080kb

input:

5
10 2 18
2 7 3 1 2 2 10 3 10 9
1 7 2 0 1 1 8 2 8 8
10 6 17
10 7 9 6 8 2 9 5 5 4
10 1 5 5 3 0 4 1 2 2
10 5 10
1 6 3 8 7 7 7 9 7 4
0 3 2 4 1 0 5 5 4 2
10 2 7
6 2 9 9 3 8 7 8 10 10
1 0 8 3 2 2 0 2 1 2
10 6 12
7 10 8 1 2 4 7 8 3 7
6 10 1 0 0 4 0 8 1 0

output:

47
59
54
64
51

result:

ok 5 lines

Subtask #2:

score: 0
Wrong Answer

Test #4:

score: 10
Accepted
time: 165ms
memory: 86820kb

input:

1
1000000 75424149 4
15519624 393474467 66570532 20552964 884794646 633920424 885627436 891022137 207531470 263467015 853563838 909020263 225156643 843397191 555130236 28501962 70380880 400094075 351542363 118716292 772000502 495729611 777038576 845271464 346378405 179347308 90713310 683636539 92786...

output:

400011543086868

result:

ok single line: '400011543086868'

Test #5:

score: 0
Wrong Answer
time: 182ms
memory: 85800kb

input:

1
1000000 290027657 13
304913277 796843021 516017645 319050677 454050563 311934679 136029540 790505371 382952680 125583971 728245481 902515808 812248168 868676972 790078499 415156440 464267202 582710403 940789661 787826252 967007727 383461878 355142003 38823668 153257857 934717389 686901242 36112867...

output:

464602224908445

result:

wrong answer 1st lines differ - expected: '464602224908438', found: '464602224908445'

Subtask #3:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #7:

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

input:

1
500 225 2
0 0 2 1 2 1 4 0 0 0 0 0 2 1 2 0 0 1 0 0 1 1 2 0 2 2 3 1 0 0 2 2 0 1 1 2 1 3 1 3 2 0 0 1 2 0 2 0 0 1 1 0 1 1 1 0 1 0 2 3 0 0 1 3 1 0 2 2 1 1 4 1 1 2 1 1 0 3 2 0 0 0 1 3 0 1 0 1 2 1 0 0 2 1 1 1 2 3 2 2 2 1 1 2 2 0 0 1 1 0 0 1 0 1 1 0 1 3 1 2 0 2 2 1 1 2 0 1 0 4 2 0 0 0 0 1 4 1 0 1 0 1 0 0 ...

output:

231

result:

ok single line: '231'

Test #8:

score: 10
Accepted
time: 3ms
memory: 16060kb

input:

1
500 253 10
1 2 1 1 0 0 1 3 3 1 0 0 0 0 0 0 0 2 1 0 0 2 1 0 0 0 2 0 0 1 2 1 0 2 2 1 1 2 1 0 2 1 0 0 0 1 0 2 2 0 1 0 0 1 0 0 1 1 1 0 1 1 0 1 2 0 1 0 0 1 1 1 0 0 0 1 2 2 1 1 1 0 3 1 0 0 0 1 0 1 1 4 3 1 0 0 0 1 0 1 3 1 1 1 1 4 1 0 0 0 1 1 1 2 2 0 0 3 0 0 1 0 2 2 1 0 2 0 1 0 2 0 0 1 1 0 2 1 0 1 1 1 0 0...

output:

278

result:

ok single line: '278'

Test #9:

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

input:

100
5 3 11
0 1 3 0 1
0 0 0 0 0
5 3 11
0 0 2 2 1
0 0 0 1 1
5 3 10
2 1 0 1 1
2 1 0 0 1
5 3 11
2 2 0 0 1
0 0 0 0 1
5 2 11
0 0 4 0 1
0 0 3 0 1
5 5 10
2 0 0 0 3
1 0 0 0 1
5 5 11
3 1 1 0 0
3 0 1 0 0
5 2 11
0 1 2 0 2
0 1 2 0 0
5 4 10
2 1 1 1 0
0 1 0 1 0
5 4 10
1 1 1 2 0
1 0 1 2 0
5 2 11
2 0 3 0 0
1 0 3 0 0...

output:

5
3
2
4
3
3
1
3
3
1
3
3
4
1
3
3
1
4
3
4
2
5
3
4
4
2
4
2
2
3
4
4
3
3
2
3
0
2
3
4
4
3
3
2
2
4
5
2
4
4
3
3
4
3
4
2
3
3
3
2
4
4
5
2
4
2
4
2
3
4
4
4
4
2
2
1
2
4
1
3
4
3
3
0
3
5
5
2
4
3
2
3
4
3
3
4
2
3
5
3

result:

ok 100 lines

Test #10:

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

input:

50
10 4 11
2 0 0 2 0 0 1 1 4 0
2 0 0 1 0 0 1 1 2 0
10 9 11
0 1 2 0 1 1 1 2 2 0
0 0 2 0 1 0 1 1 2 0
10 4 11
1 2 1 3 0 0 2 0 1 0
1 0 1 3 0 0 0 0 0 0
10 9 10
1 0 1 1 2 1 0 1 2 1
1 0 0 0 2 0 0 1 0 0
10 7 11
0 3 0 2 3 0 0 2 0 0
0 3 0 0 3 0 0 2 0 0
10 9 10
0 1 0 1 1 1 1 2 1 2
0 0 0 0 1 1 1 0 0 0
10 6 11
0...

output:

6
3
6
6
3
7
7
6
2
7
3
6
8
4
6
5
3
5
8
8
6
5
7
8
8
8
4
8
5
4
3
5
7
5
4
8
5
5
7
6
7
6
7
8
8
4
2
4
7
6

result:

ok 50 lines

Subtask #4:

score: 0
Wrong Answer

Dependency #3:

100%
Accepted

Test #11:

score: 0
Wrong Answer
time: 3ms
memory: 16148kb

input:

60
10 17 2
14 8 11 5 9 14 9 9 8 13
12 3 8 5 9 1 0 4 2 10
10 13 2
11 11 10 15 8 12 7 8 8 10
11 6 3 8 2 4 7 8 1 4
10 7 2
18 6 15 6 11 6 12 8 9 9
15 0 9 0 5 6 0 6 4 3
10 4 3
12 8 16 11 9 5 6 9 10 14
0 0 5 7 8 1 6 2 1 5
10 23 3
10 14 11 7 9 7 7 12 17 6
5 8 1 5 5 7 7 1 4 3
10 27 3
13 7 11 12 11 12 10 9 9...

output:

57
60
64
75
60
55
68
67
62
76
76
69
71
61
73
60
54
62
62
67
61
71
75
64
63
73
73
56
65
67
63
40
40
46
57
58
53
64
64
46
42
30
39
46
61
54
55
48
64
51
55
57
57
73
40
63
56
71
55
38

result:

wrong answer 58th lines differ - expected: '70', found: '71'

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 0ms
memory: 16088kb

input:

600
10 21 2
1434256 1792820 8964100 10756920 6454152 717128 9681228 7529844 7171280 10398356
1075692 1075692 1434256 10039792 358564 717128 717128 5737024 3227076 1792820
10 5 4
5500368 6875460 4125274 687544 5500368 4469049 4125276 2750183 9969416 5156593
4469049 3781503 687546 0 1718865 343773 0 2...

output:

46254742
42284068
28465970
36815342
18797080
16608540
59809954
55963386
98157466
99455211
58990996
4474138
59994584
40677040
117326435
26562075
51644186
94269994
59007134
38720301
55628210
40921356
30237996
20727720
83424160
84045033
66629574
18910773
84890678
72094414
49832625
110722258
1360310
120...

result:

ok 600 lines

Test #25:

score: 15
Accepted
time: 30ms
memory: 16384kb

input:

2000
10 19 8
6876660 3438330 687664 11690316 2062992 2062992 2062992 687666 687666 1375330
6876660 2062998 0 5501328 0 0 0 687666 687666 687666
10 15 3
4087344 17371212 15327539 13283868 16349376 9196524 5109180 16349376 7152852 2043672
4087344 15327540 12262032 0 0 2043672 4087344 7152852 4087344 2...

output:

28194264
79703196
11089764
62810972
41503410
26040944
91781613
70998177
18207816
55013070
7566990
59042320
17974772
28271700
5677866
9725704
1225548
29982198
17802890
343025
45817818
73177656
86443886
15493720
79583772
32225792
56508512
62526146
37987857
105719026
44344500
16914540
65295200
2337432
...

result:

ok 2000 lines

Test #26:

score: 15
Accepted
time: 27ms
memory: 20408kb

input:

10
20000 5 2
7 8 3 4 8 6 4 4 10 3 7 10 9 5 10 10 2 4 1 9 3 5 5 4 5 10 2 7 4 5 8 5 5 6 8 0 6 10 7 4 8 10 9 4 4 8 2 9 1 10 9 6 10 6 0 0 3 9 7 8 9 7 2 6 0 2 6 10 2 3 8 7 4 2 4 3 1 4 10 8 9 9 0 6 6 6 9 6 9 3 5 7 2 10 4 7 4 0 1 4 6 8 10 0 2 4 8 3 9 7 1 6 2 3 0 10 4 10 7 6 2 6 2 1 3 4 6 6 6 5 0 7 9 4 6 4 ...

output:

71942
79648
80304
80156
78462
78255
78279
80196
71584
80160

result:

ok 10 lines

Test #27:

score: 15
Accepted
time: 30ms
memory: 33552kb

input:

1
200000 6 3
4 9 6 7 1 6 9 9 6 0 6 6 10 2 10 7 9 3 9 3 4 10 7 4 0 6 4 8 1 7 7 3 3 8 3 2 8 0 0 3 7 8 7 1 10 0 9 9 2 4 9 3 3 7 9 7 6 9 6 3 0 7 10 3 5 3 3 7 1 5 7 2 0 1 7 3 0 3 3 6 9 3 7 5 4 8 4 4 5 7 6 10 5 7 3 10 9 10 6 3 9 5 1 6 2 9 10 4 8 6 3 7 1 1 6 7 9 2 4 1 3 4 2 3 6 8 4 6 6 2 9 0 9 7 8 7 2 10 3...

output:

784158

result:

ok single line: '784158'

Test #28:

score: 15
Accepted
time: 31ms
memory: 33700kb

input:

1
200000 625508899 15
345213785 511317551 965642081 319470068 565100537 333251174 841352736 179023177 862789508 166652869 2186333 60513700 978658289 659875995 79575594 140295543 789154341 115117210 886053005 322688547 369817688 522371031 674303291 504515442 937206505 363662373 789414269 429761083 20...

output:

93707621177370

result:

ok single line: '93707621177370'

Test #29:

score: 15
Accepted
time: 40ms
memory: 16076kb

input:

10000
20 6796301 3
755701046 270269710 868995043 455252803 552995120 216589347 308374356 319755458 864407120 307671952 789522118 298742001 651722816 85320615 852551233 566366054 382681520 148349604 76710427 157542884
288645171 188985163 521346241 228598149 139235477 102432443 141050980 98824375 6650...

output:

6738104379
7984192524
6682643982
8551242334
9875609213
9019962954
7205803780
7820948160
9790879717
9459146304
9934532300
8405432040
9944575540
10039079037
8132669988
7538929866
8956534221
9900173865
10454166810
11403597671
9271582385
8293875636
9413770509
10870598813
7757327982
7862659764
1078741223...

result:

ok 10000 lines

Test #30:

score: 15
Accepted
time: 35ms
memory: 16080kb

input:

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

output:

112
78
36
34
19
50
84
88
19
36
98
0
56
75
0
36
77
48
54
18
64
38
72
90
65
49
60
96
77
80
42
48
52
48
20
0
48
49
72
56
52
64
0
66
0
36
90
46
81
72
56
32
48
58
0
28
56
84
51
0
40
34
40
52
72
77
72
52
16
44
60
0
18
57
36
18
78
91
65
32
45
13
60
32
30
52
60
68
70
66
38
104
20
85
0
15
54
40
28
0
56
54
40...

result:

ok 20000 lines

Subtask #7:

score: 10
Accepted

Dependency #6:

100%
Accepted

Test #31:

score: 10
Accepted
time: 4ms
memory: 16460kb

input:

201
10 20 2
23109525 6676084 9243810 24136615 10270900 2567725 4621905 9757355 14379260 8216719
17460530 0 0 8216720 2054180 1540635 1027090 7189630 13865715 1540635
10 18 2
9467685 12623580 2524716 22722444 2524716 18304191 11992401 15779474 19566549 23353622
8836506 3155895 2524716 631179 0 631179...

output:

77545280
99726268
157279422
96228240
215210722
78400808
164201580
8352022
15980968
180557844
25127678
164747520
191782536
148699960
64122234
5534301
60653126
307987770
13660994
157212651
55968514
120973846
99564294
84986478
70624418
69421376
144626860
25232990
11433744
117459816
207764786
9548510
16...

result:

ok 201 lines

Test #32:

score: 10
Accepted
time: 144ms
memory: 24960kb

input:

10
100000 10 2
2 2 2 2 3 4 10 4 10 10 2 5 6 6 8 8 5 0 2 5 4 7 10 6 6 5 6 4 9 2 2 1 7 9 1 2 6 6 1 2 2 7 5 4 6 5 3 6 9 10 2 7 3 3 3 8 0 7 2 9 6 5 4 8 2 9 1 9 6 3 0 10 6 8 4 8 1 2 6 5 2 7 3 3 8 6 3 9 7 4 6 7 4 1 2 6 9 9 0 7 6 3 2 4 4 7 4 6 9 9 7 6 10 10 9 2 9 4 6 7 1 10 2 5 8 5 5 5 0 4 0 0 5 4 6 2 7 4 ...

output:

359288
399748
399940
358746
399096
390879
358514
399044
390396
359730

result:

ok 10 lines

Test #33:

score: 10
Accepted
time: 177ms
memory: 85308kb

input:

1
1000000 514340876 7
795245439 650075960 435715823 840206363 388197923 996126461 446244962 286227265 656509427 463441679 899492335 166901698 826758383 773684857 571102368 929861528 539053049 175795382 294360645 686212049 696711243 461268396 662126986 903290491 694039806 307379359 207285558 67292588...

output:

437836689106761

result:

ok single line: '437836689106761'

Test #34:

score: 10
Accepted
time: 158ms
memory: 85152kb

input:

1
1000000 577026094 15
23907 22435 48930 87611 24385 86358 7112 3906 69219 27301 10984 52149 97804 97157 65615 70640 76368 68062 59758 98553 50531 52275 56992 52745 89045 87978 83677 46662 13049 66495 39841 62110 67635 68844 81623 29525 90532 6515 77645 79103 27592 73817 59148 4120 99026 10382 39341...

output:

46375358295

result:

ok single line: '46375358295'

Subtask #8:

score: 0
Wrong Answer

Dependency #6:

100%
Accepted

Test #35:

score: 15
Accepted
time: 42ms
memory: 16076kb

input:

20000
10 151 45
253 3960 654 4062 4904 3777 2556 4932 902 49
207 2430 505 3524 970 1134 1387 3976 92 49
10 864 78
3823 2125 1009 3123 4305 4827 5723 4585 78 4078
9 684 996 133 659 1656 1724 3907 78 22
10 29 46
2039 3959 156 5033 4527 1478 5049 34 75 188
1823 3215 20 1551 1806 341 3741 34 75 4
10 119...

output:

25335
32448
22034
17088
24024
28152
26600
27734
25433
26460
14508
24180
25137
26550
28077
14224
24300
27066
32465
25146
46056
57024
42366
51379
70547
57800
65281
49200
72534
41850
55754
49440
21816
48550
61264
43264
45178
69158
39480
56088
39098
53100
58188
45933
52650
36288
35530
52052
50511
54815
...

result:

ok 20000 lines

Test #36:

score: 15
Accepted
time: 36ms
memory: 33684kb

input:

1
200000 404083085 35552315
46344505 529371185 409786544 351931390 182601215 373772288 149232053 362339023 789634565 891849451 389192040 794353411 500952551 803649024 291922978 515994756 362695878 167394967 155334508 481175182 365083801 929210442 258539495 22934569 2495994 266609592 567544892 356697...

output:

96429788305525

result:

ok single line: '96429788305525'

Test #37:

score: 15
Accepted
time: 44ms
memory: 33812kb

input:

1
200000 944027169 702950
4161226 8195573 5937765 7215331 9361088 244238 2651131 7255203 9764899 3692096 1868990 4798311 2786170 6990000 9297989 3607918 7567580 6139350 1604385 5414197 6572788 278140 6479487 4888675 7151784 5953956 5447913 3929002 5996918 2750455 8780049 7481304 4679480 2686053 9508...

output:

998261003076

result:

ok single line: '998261003076'

Test #38:

score: 15
Accepted
time: 25ms
memory: 16372kb

input:

2000
10 13 4
85 5 80 30 35 45 55 89 100 97
20 5 70 5 15 5 20 5 20 30
10 14 3
39 60 35 3 85 5 15 30 18 35
0 25 20 0 70 5 5 5 0 20
10 2 2
4 75 10 55 45 95 10 30 70 25
0 60 5 5 35 20 0 30 20 25
10 20 4
95 45 100 70 60 65 10 70 20 54
60 30 85 5 25 5 5 25 10 10
10 15 2
4 5 95 95 30 10 40 44 14 30
0 5 35 ...

output:

500
237
278
464
238
300
490
194
456
308
376
440
513
385
330
590
500
405
380
393
44392514672
45103226922
48438945126
40588153581
42746880071
41573735832
41906269952
43664993808
41875450050
44761351167
40968094648
46143942320
42441202922
49608391781
39619875750
44325610512
44961797225
42034985142
4026...

result:

ok 2000 lines

Test #39:

score: 0
Wrong Answer
time: 44ms
memory: 16116kb

input:

20000
10 22 5
9 18 4 7 28 3 2 6 12 30
3 6 2 1 16 1 2 5 3 29
10 22 5
15 2 2 14 16 12 28 26 17 16
10 1 1 11 13 3 2 4 17 8
10 30 3068
21 13 14 21 27 26 11 13 5 4
2 4 10 7 15 25 1 1 3 3
10 18 2
6 28 10 9 23 11 24 27 3 11
4 28 3 9 16 7 9 10 3 6
10 5 2
5 20 21 19 24 8 1 5 10 17
3 10 9 16 1 1 1 1 7 4
10 12...

output:

84
107
125
91
91
117
12037965
90
86
114490710
85
104
104
165
125
136
34121191
131
145
104596305
114
182209234
143
104
113840116
111
149
121772710
93
73
71056575
150356426
97
7109954
45171004
125031432
102
103
88
130
93
79
170
190
169
126
121
163
86
137
65087317
132
120
169
106552593
49486921
192
115...

result:

wrong answer 61st lines differ - expected: '151', found: '152'

Subtask #9:

score: 0
Skipped

Dependency #2:

0%