QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#36126#4269. Rainy MarketsWuyanru5 355ms27196kbC++174.6kb2022-06-24 14:55:072022-06-24 14:56:24

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-24 14:56:24]
  • 评测
  • 测评结果:5
  • 用时:355ms
  • 内存:27196kb
  • [2022-06-24 14:55:07]
  • 提交

answer

//DABC ABCD ABCA DBAA
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<bitset>
#include<cstdio>
#include<vector>
#include<random>
#include<ctime>
#include<queue>
#include<map>
#include<set>
namespace nb
{
    #define y1 qwyeiurbvyiorvyiuqwrqweir
    #define j1 rwehiuqrwiviouwaawhrfiuab
    using namespace __gnu_pbds;
    using namespace std;
    #define pause system("pause")
    #define memset(array,num) memset(array,num,sizeof(array))
    template<typename A,typename B>
    using ht=gp_hash_table<A,B>;
    template<typename A>
    using pqueue=priority_queue<A,vector<A>,greater<A> >;
    template<typename A>
    using prque=priority_queue<A>;
    template<typename A>
    using vc=vector<A>;
    using ll=long long;
    using db=double;
    using ld=long double;
    using pi=pair<int,int>;
    using vpi=vector<pi>;
    using pli=pair<ll,int>;
    using vpli=vector<pli>;
    using pl=pair<ll,ll>;
    using vi=vector<int>;
    using vpl=vector<pl>;
    using vl=vector<ll>;
    mt19937 _rand(time(0)^clock());
    inline int lowbit(int i){ return i&(-i);}
    inline int read()
    {
        int s=0,w=1;char ch;
        while((ch=getchar())>'9'||ch<'0') if(ch=='-') w=-1;
        while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
        return s*w;
    }
    inline ll lread()
    {
        ll s=0,w=1;char ch;
        while((ch=getchar())>'9'||ch<'0') if(ch=='-') w=-1;
        while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
        return s*w;
    }
    inline ll qow(ll a,int b,int mod)
    {
        ll ans=1;
        while(b)
        {
            if(b&1) ans=ans*a%mod;
            a=a*a%mod;
            b>>=1;
        }
        return ans;
    }
    inline ll cheng(ll a,ll b,ll mod)
    {
        ll ans=0;
        while(b)
        {
            if(b&1) ans+=a;
            a=a*2%mod;
            b>>=1;
        }
        return ans;
    }
    inline ll qow(ll a,ll b,ll mod)
    {
        ll ans=1;
        while(b)
        {
            if(b&1) ans=cheng(ans,a,mod);
            a=cheng(a,a,mod);
            b>>=1;
        }
        return ans;
    }
    template<const int N,const int M>
    struct graph
    {
        int head[N+5];
        int t[M+5];
        int n[M+5];
        int cntm;
        graph(){ cntm=1;}
        void clear(int n)
        {
            cntm=1;
            for(int i=1;i<=n;i++) head[i]=0;
        }
        void ad(int u,int v)
        {
            cntm++;
            t[cntm]=v;
            n[cntm]=head[u];
            head[u]=cntm;
        }
        void add(int u,int v)
        {
            ad(u,v);
            ad(v,u);
        }
        int st(int u){ return head[u];}
        int to(int u){ return t[u];}
        int nx(int u){ return n[u];}
    };
    template<const int N,const int M>
    struct graphw
    {
        int head[N+5];
        int ww[M+5];
        int t[M+5];
        int n[M+5];
        int cntm;
        graphw(){ cntm=1;}
        void ad(int u,int v,int w)
        {
            cntm++;
            t[cntm]=v;
            n[cntm]=head[u];
            ww[cntm]=w;
            head[u]=cntm;
        }
        void add(int u,int v,int w)
        {
            ad(u,v,w);
            ad(v,u,w);
        }
        int st(int u){ return head[u];}
        int to(int u){ return t[u];}
        int nx(int u){ return n[u];}
        int w(int u){ return ww[u];}
    };
}
using namespace nb;
int buy[1000001];
int l[1000001];
int r[1000001];
int b[1000001];
int p[1000001];
int u[1000001];
ll ans;
int n;
int main()
{
    n=read();
    for(int i=1;i<=n;i++) b[i]=read();
    for(int i=1;i<n;i++) p[i]=read();
    for(int i=1;i<n;i++) u[i]=read();
    for(int i=1;i<n;i++)
    {
        int num=min(u[i],p[i]);ans+=num,p[i]-=num;
        int num1=min(p[i],b[i]);p[i]-=num1,b[i]-=num1;
        int num2=min(p[i],b[i+1]);p[i]-=num2,b[i+1]-=num2;
        l[i]=num1,r[i]=num2,buy[i]=num;
        // printf("%d : %d %d %d  %d\n",i,l[i],buy[i],r[i],p[i]);
        if(p[i]){ printf("NO\n");return 0;}
    }
    printf("YES\n");
    for(int i=1;i<n;i++)
    {
        int num1=min(buy[i],b[i]);ans-=num1;
        l[i]+=num1,b[i]-=num1,buy[i]-=num1;

        int num3=min(r[i],b[i]);
        l[i]+=num3,b[i]-=num3,r[i]-=num3,b[i+1]+=num3;

        int num2=min(buy[i],b[i+1]);ans-=num2;
        r[i]+=num2,b[i+1]-=num2,buy[i]-=num2;
    }
    printf("%lld\n",ans);
    for(int i=1;i<n;i++) printf("%d %d %d\n",l[i],buy[i],r[i]);
    return 0;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 2ms
memory: 13880kb

input:

3
10 15 10
20 20
0 0

output:

NO

result:

ok IMPOSSIBLE

Test #2:

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

input:

2
813741488 132495829
946237313
0

output:

YES
0
813741488 0 132495825

result:

ok good plan

Test #3:

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

input:

2
175700937 435906025
546265275
0

output:

YES
0
175700937 0 370564338

result:

ok good plan

Test #4:

score: 0
Accepted
time: 75ms
memory: 16548kb

input:

1000000
999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 99999...

output:

NO

result:

ok IMPOSSIBLE

Test #5:

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

input:

1000000
500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 50...

output:

NO

result:

ok IMPOSSIBLE

Test #6:

score: 0
Accepted
time: 89ms
memory: 26984kb

input:

1000000
999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 999998 99999...

output:

NO

result:

ok IMPOSSIBLE

Test #7:

score: 0
Accepted
time: 111ms
memory: 27132kb

input:

1000000
500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 500000000 50...

output:

NO

result:

ok IMPOSSIBLE

Test #8:

score: 0
Accepted
time: 1ms
memory: 13972kb

input:

4000
371896518 731935279 428414487 878930842 569178148 826228818 1000783912 686784551 510567707 203391729 232379073 1351183869 429219170 767480826 351913312 143053268 871061720 171086334 342694087 784356999 505826785 816153880 512894008 199747092 526361485 936149088 572347607 543039867 480605813 967...

output:

YES
0
371896518 0 345249820
386685459 0 362308188
66106299 0 473313580
405617262 0 180574503
388603645 0 458982202
367246616 0 575000419
425783493 0 355865390
330919161 0 379939779
130627928 0 56406124
146985605 0 157230285
75148788 0 770513948
580669921 0 33222618
395996552 0 459383357
308097469 0 ...

result:

ok good plan

Test #9:

score: 0
Accepted
time: 1ms
memory: 14012kb

input:

4000
272373873 140697311 935891972 459510485 380217614 889215567 852306701 971803793 240167795 156812678 430652906 1311456239 1008344772 440041142 623974894 450082368 796550780 952767338 836068185 1145186862 273207527 1390469317 568188650 409763894 1342431187 848500582 958109270 564107379 763581098 ...

output:

YES
0
272373873 0 25945708
114751603 0 692287352
223159716 0 0
420496167 0 0
380217614 0 586382179
302833388 0 259549219
592757482 0 155581828
814606373 0 0
157875190 0 0
156812678 0 64831972
365820934 0 631588619
679867620 0 132962752
814116034 0 0
440041142 0 248961401
290877953 0 0
450082368 0 10...

result:

ok good plan

Test #10:

score: 0
Accepted
time: 221ms
memory: 27168kb

input:

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

output:

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

result:

ok good plan

Test #11:

score: 0
Accepted
time: 192ms
memory: 27196kb

input:

1000000
18 55 93 88 94 52 16 84 46 68 125 110 17 47 103 46 93 92 88 27 78 117 99 66 29 75 76 74 62 74 109 62 88 46 83 131 29 164 30 170 68 117 18 107 96 41 52 14 81 31 102 54 71 35 37 98 111 30 63 22 55 50 107 38 77 53 29 111 65 87 16 149 31 157 37 120 93 77 43 26 72 63 115 25 113 83 91 31 94 118 45...

output:

YES
0
18 0 47
8 0 37
56 0 22
66 0 16
78 0 15
26 0 0
16 0 78
3 0 0
46 0 31
37 0 62
63 0 36
70 0 0
17 0 1
46 0 39
64 0 6
40 0 42
51 0 35
57 0 10
57 0 0
27 0 61
17 0 30
87 0 9
90 0 6
49 0 0
29 0 54
21 0 48
28 0 6
53 0 0
62 0 32
42 0 37
72 0 7
55 0 25
63 0 0
46 0 38
45 0 40
82 0 0
29 0 70
90 0 0
30 0 50...

result:

ok good plan

Test #12:

score: 0
Accepted
time: 313ms
memory: 27176kb

input:

1000000
178441775 587046890 860703793 561257299 693824238 395494284 801724507 560679166 363880968 103016537 783661617 363374822 446793305 960585380 181837377 979324306 639631097 529788670 304861238 993122151 554377226 517712754 534629728 229097317 533996627 1068084785 1087656145 592993085 1390362594...

output:

YES
0
178441775 0 528518043
58528847 0 53320056
807383737 0 131842186
429415113 0 13178207
564222608 0 0
395494284 0 216657034
585067473 0 144644689
416034477 0 38150521
255811507 0 0
103016537 0 270268545
453286009 0 0
342360919 0 0
446793305 0 9748854
950836526 0 15180296
166657081 0 541310229
438...

result:

ok good plan

Test #13:

score: 0
Accepted
time: 355ms
memory: 27192kb

input:

1000000
1079082107 1805887075 1580449789 1907786817 1949602241 1413963033 1906969438 1088894636 1059876384 1334842592 1924285416 1717408984 1366347625 1639429881 2000000000 1316512185 1706824144 1279619618 1843220776 1438183346 2000000000 1301459336 1961362144 1265003658 1068417153 1395656752 130793...

output:

YES
0
441651655 0 0
859286186 0 0
728235500 0 0
982819619 0 0
325837350 0 0
748274981 0 0
583982091 0 0
113710624 0 0
97061944 0 0
745751519 0 0
864526483 0 0
451103807 0 0
611184387 0 0
736090299 0 0
789435804 0 0
548225961 0 0
417143741 0 0
721744307 0 0
342529590 0 0
884483956 0 0
772491858 0 0
5...

result:

ok good plan

Test #14:

score: 0
Accepted
time: 69ms
memory: 15832kb

input:

1000000
0 0 0 0 0 0 0 0 0 0 0 0 0 398537522 0 0 0 0 0 0 244114262 0 0 0 49582201 0 0 0 0 0 0 0 0 0 0 0 114156090 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 276383010 0 0 0 0 0 0 0 0 0 0 0 238421694 0 0 0 0 0 0 0 0 0 0 416875781 0 0 0 1926236 0 0 300343185 0 109035453 0 274553953 0 0 0 0 0 93628808 0 0 12529967 0...

output:

NO

result:

ok IMPOSSIBLE

Test #15:

score: 0
Accepted
time: 355ms
memory: 27112kb

input:

999991
362620181 419430824 959309529 689600870 1044767344 262407801 242725738 684162961 416120339 350093946 805001726 247503019 1060528882 143521393 1146540723 342868104 436569605 860322115 114352793 948543818 1216710231 867182103 673579219 492981025 590240685 705828863 284937955 278491077 782285856...

output:

YES
0
362620181 0 262181641
157249183 0 468410272
490899257 0 478663476
210937394 0 679679833
365087511 0 150634404
111773397 0 29092498
213633240 0 579082708
105080253 0 85143023
330977316 0 1524874
348569072 0 607009090
197992636 0 151041686
96461333 0 733564900
326963982 0 62553038
80968355 0 781...

result:

ok good plan

Test #16:

score: 0
Accepted
time: 343ms
memory: 27152kb

input:

999994
194311234 853666753 489811589 408080073 1224001542 268060267 1382666394 417256255 1090485464 834595775 139737097 869854174 301311326 332264877 214704389 927948470 753062301 431793983 1198116076 467942213 826146975 555112601 557658840 522577114 966962241 787166897 238405691 466363983 939205736...

output:

YES
0
194311234 0 350210838
503455915 0 195641053
294170536 0 214315471
193764602 0 784247778
439753764 0 66490690
201569577 0 740285986
642380408 0 320350787
96905468 0 652988981
437496483 0 433531225
401064550 0 5829676
133907421 0 343510981
526343193 0 129848751
171462575 0 123705117
208559760 0 ...

result:

ok good plan

Test #17:

score: 0
Accepted
time: 273ms
memory: 27132kb

input:

999998
178369676 1009119158 792325429 1069529185 264757683 983958846 884087224 612160518 936156616 1287003047 690020396 839393580 395482822 326073635 646837092 995709986 763379797 1092681665 733879514 196603881 552349242 240726540 598482138 864055022 840843989 302521827 764829135 726609159 223557577...

output:

YES
0
178369676 0 761538311
247580847 0 428508590
363816839 0 452906924
616622261 0 240198238
24559445 0 922821081
61137765 0 461606687
422480537 0 483042178
129118340 0 720847141
215309475 0 658487927
628515120 0 287938945
402081451 0 173944992
665448588 0 192710102
202772720 0 38307243
287766392 0...

result:

ok good plan

Test #18:

score: 0
Accepted
time: 332ms
memory: 27112kb

input:

999999
12681118 657834398 465540846 711660704 79403843 894689744 595655060 1205852779 969418859 102772032 897294952 891721973 744485422 677939352 579561570 468071389 778581191 652243280 648600935 1426504741 824303223 465806115 428262168 76238313 889105955 539945663 431711152 694539304 783616883 1152...

output:

YES
0
12681118 0 245277996
412556402 0 432923690
32617156 0 160895051
550765653 0 48198502
31205341 0 544732432
349957312 0 429601029
166054031 0 686151793
519700986 0 452946593
516472266 0 88151787
14620245 0 771636009
125658943 0 614982213
276739760 0 365238524
379246898 0 305371253
372568099 0 30...

result:

ok good plan

Test #19:

score: 0
Accepted
time: 283ms
memory: 27132kb

input:

999994
105352982 941388977 302290176 898523472 1014970449 113198429 934511085 400594522 607937267 279795582 931972205 347084581 1038198569 978421124 428546291 422726381 274109040 1304650136 344490746 456679779 727555808 809439007 1071521079 1014249005 388925217 1043662999 216657655 1111308849 246875...

output:

YES
0
105352982 0 639910263
301478714 0 221366143
80924033 0 835082109
63441363 0 927796185
87174264 0 40758243
72440186 0 635792038
298719047 0 360067524
40526998 0 553364209
54573058 0 64562721
215232861 0 401522628
530449577 0 25887876
321196705 0 458701237
579497332 0 61672984
916748140 0 735437...

result:

ok good plan

Test #20:

score: 0
Accepted
time: 354ms
memory: 27188kb

input:

999993
56210201 221341475 680034720 1375948518 726364872 547648729 243945585 804097127 476071747 643755769 1287838618 256792057 472829075 675725382 603000860 707661392 434763104 506227983 1134609988 1043306929 520405674 620491648 864514774 253771847 575223973 461390195 1408548388 785504344 274967311...

output:

YES
0
56210201 0 198210941
23130534 0 615296608
64738112 0 703875551
672072967 0 296749144
429615728 0 546894993
753736 0 45551969
198393616 0 150451014
653646113 0 201982966
274088781 0 388917047
254838722 0 504320673
783517945 0 122880962
133911095 0 57772359
415056716 0 5722207
670003175 0 275073...

result:

ok good plan

Test #21:

score: 0
Accepted
time: 307ms
memory: 27132kb

input:

999997
445561713 192328947 369257224 1192025748 311164945 337494457 552852753 325151500 515346800 1211592632 439538409 1127737795 847740627 701778281 1081552554 745876654 332798664 1660456985 220716740 500722823 558847443 390793361 899886828 156850780 993587153 491564199 655958516 788283127 30902327...

output:

YES
0
445561713 0 143771628
48557319 0 312665302
56591922 0 360133844
831891904 0 37648579
273516366 0 75231301
262263156 0 224544050
328308703 0 59136822
266014678 0 54827098
460519702 0 510100978
701491654 0 241054512
198483897 0 654364511
473373284 0 424121543
423619084 0 499376882
202401399 0 67...

result:

ok good plan

Test #22:

score: 0
Accepted
time: 287ms
memory: 27088kb

input:

999994
540839997 1131911886 728619281 1464911795 246965057 1099020568 482984814 970575384 820698269 309216115 223742504 913698653 1383846475 582149848 1105653962 516109770 591959777 343256477 954034061 1218202097 736422872 1032160342 878658765 624918126 630795258 1118308538 1486789155 316476707 8361...

output:

YES
0
540839997 0 401825798
730086088 0 256274806
472344475 0 481485894
822018270 0 0
246965057 0 287934892
811085676 0 116689920
366294894 0 31000207
728081258 0 0
820698269 0 148532705
133233661 0 0
223742504 0 743411936
170286717 0 825913422
557933053 0 300212997
281936851 0 140980364
897746803 0...

result:

ok good plan

Test #23:

score: 0
Accepted
time: 291ms
memory: 27088kb

input:

999995
161104584 775717100 607413116 529451705 728572751 826066774 496326617 620182015 856095791 591001858 679129019 766845806 1113383064 318137834 944033511 875558011 600090053 1171434920 533970501 840735958 487170715 260402923 567242216 1209942696 1152578478 515859249 770329830 1139055137 36784336...

output:

YES
0
161104584 0 263750549
511966551 0 130974731
476438385 0 261256182
268195523 0 404300040
324272711 0 112298245
713768529 0 139344027
356982590 0 211665970
408516045 0 587180139
268915652 0 453096138
137905720 0 473492718
205636301 0 241606879
525238927 0 396677187
716705877 0 35659484
282478350...

result:

ok good plan

Test #24:

score: 0
Accepted
time: 330ms
memory: 27044kb

input:

999995
555633343 1118284301 464544056 897192926 174743583 430995707 985353434 1203427161 908451623 317651036 193634656 1001012963 274708660 610368690 346656281 252294817 841220837 823156915 630705655 992786776 240453483 489103415 770561004 982785938 433968262 578056384 1179866693 642110069 437016209...

output:

YES
0
555633343 0 312436785
805847516 0 27540912
437003144 0 314115568
583077358 0 82788277
91955306 0 129007410
301988297 0 551568115
433785319 0 565274174
638152987 0 293981889
614469734 0 110908093
183587926 0 0
193634656 0 301483200
699529763 0 150172674
124535986 0 499256028
111112662 0 1279773...

result:

ok good plan

Test #25:

score: 0
Accepted
time: 88ms
memory: 20212kb

input:

999998
56329177 1053178440 861437337 1505577907 891308195 645768945 361720696 983606011 204182053 399265863 264778836 641839096 296735199 722061054 93627639 515044436 763468184 377271139 689314203 952884003 878928795 344167664 1109358100 191951630 945870237 1430925776 796030676 683147576 591501313 4...

output:

NO

result:

ok IMPOSSIBLE

Test #26:

score: 0
Accepted
time: 87ms
memory: 21224kb

input:

999998
517175740 763293507 5695645 1019956810 429520673 970484444 1071138189 497913353 236358217 611067785 555341673 483846993 611008868 608922674 1113052150 99561285 419799945 225884908 930024421 377573314 246518351 835481041 410129917 752239263 1056692894 496959814 912892370 787624634 853994440 93...

output:

NO

result:

ok IMPOSSIBLE

Test #27:

score: 0
Accepted
time: 289ms
memory: 27068kb

input:

999992
518544612 891830402 514407029 655275132 905928579 665925952 455625785 661633489 790523364 1007026619 361651074 404407207 611280703 284739501 846385203 266364155 799890972 872879556 849679860 1071206003 449376119 711761370 413444412 1235770615 278053061 1128785163 985113627 18027105 884493381 ...

output:

YES
0
518544612 0 88321747
803508655 0 151067989
363339040 0 377863549
277411583 0 714917809
191010770 0 400657448
265268504 0 11728439
443897346 0 514263581
147369908 0 542983510
247539854 0 509049511
497977108 0 63762607
297888467 0 213952843
190454364 0 239177713
372102990 0 43974027
240765474 0 ...

result:

ok good plan

Test #28:

score: 0
Accepted
time: 317ms
memory: 27048kb

input:

999992
891756946 220232418 526219496 987455198 1206398399 518391240 1139098537 1165307965 1084239253 321333312 690783670 630453327 745900241 538324110 542683515 850332679 750477473 813402246 557222857 1431385403 530480865 691065648 1207792011 891459681 851395874 856982288 307904874 991585510 5261966...

output:

YES
0
891756946 0 55693600
164538818 0 359397874
166821622 0 687848406
299606792 0 321583783
884814616 0 44946430
473444810 0 298635376
840463161 0 124971685
942568213 0 0
965528421 0 0
321333312 0 238793287
451990383 0 191541608
388138701 0 0
745900241 0 219714348
318609762 0 308014264
234669251 0 ...

result:

ok good plan

Test #29:

score: 0
Accepted
time: 264ms
memory: 27096kb

input:

999994
422740989 556808146 1212769873 470639281 1230917208 371247022 896755997 112988247 596489211 699116733 390977036 1071206218 522560798 638333781 795657629 1294921388 228730237 679726359 833403377 779961535 655454921 638690223 208677338 1014408162 495649048 596139031 297244046 1321010459 6824496...

output:

YES
0
422740989 0 526464371
30343775 0 520489676
692280197 0 204632316
266006965 0 700302192
530615016 0 62884520
308362502 0 20229790
876526207 0 32849977
80138270 0 356221670
240267541 0 573548191
125568542 0 149862322
241114714 0 599664476
471541742 0 31071541
491489257 0 458449980
179883801 0 56...

result:

ok good plan

Test #30:

score: 0
Accepted
time: 323ms
memory: 27072kb

input:

999992
88183894 248015460 1145927802 224808394 473064030 743979886 377396044 1004343810 481184308 752903066 424609820 432015723 789339331 473897732 327644447 537201415 270931790 1004307294 544305830 900300386 576289591 1266823618 327448164 196355308 1247590666 577073153 475300106 837132188 555422209...

output:

YES
0
88183894 0 57442690
190572770 0 274028867
871898935 0 72139132
152669262 0 150385677
322678353 0 423359607
320620279 0 199763758
177632286 0 547842290
456501520 0 375200681
105983627 0 10165724
742737342 0 111250922
313358898 0 139131567
292884156 0 45969101
743370230 0 182736002
291161730 0 8...

result:

ok good plan

Test #31:

score: 0
Accepted
time: 309ms
memory: 27188kb

input:

999992
19589691 883026885 133940776 1057877520 706974538 685814332 183916779 507554964 532121358 262618457 1078368277 934614831 374787038 692757956 525236381 764522661 364363488 568287055 969053816 1018066884 455798832 314991412 453396823 1627682711 219509508 732787265 754901154 566701353 617924976 ...

output:

YES
0
19589691 0 7975342
875051543 0 94406631
39534145 0 353137886
704739634 0 128000787
578973751 0 203084494
482729838 0 40156060
143760719 0 83845873
423709091 0 260492029
233751068 0 0
262618457 0 707544023
370824254 0 411892908
404212232 0 0
374787038 0 103388059
589369897 0 45054519
445033666 ...

result:

ok good plan

Test #32:

score: 0
Accepted
time: 303ms
memory: 27120kb

input:

999997
218000490 1012906323 606693865 941943265 275519593 780960938 298026168 909319651 742953259 1013362275 1046052621 169983878 1305570895 323650781 615550119 401398890 1336499612 475695393 144058337 304477777 1359586432 531321420 851101089 152914504 968175320 798388186 802849808 1019675574 384842...

output:

YES
0
218000490 0 348731162
664175161 0 301164946
305528919 0 294109260
647834005 0 93201716
182317877 0 182264899
598696039 0 229602120
68424048 0 434587988
474731663 0 335917102
407036157 0 402027528
611334747 0 344933200
701119421 0 34645229
135338649 0 572950022
732620873 0 131206229
192444552 0...

result:

ok good plan

Test #33:

score: 0
Accepted
time: 89ms
memory: 20424kb

input:

999997
471964403 303031649 538564982 947225686 599252590 352198299 1239188034 589823362 922791624 52319524 1186176846 434648327 802030355 936214478 565249805 620297269 857364577 1015588510 736473680 743446661 558397854 1234643778 683888380 328668519 290855784 700022883 1382675642 142450605 584623206...

output:

NO

result:

ok IMPOSSIBLE

Test #34:

score: 0
Accepted
time: 124ms
memory: 20840kb

input:

999995
183084148 782519786 742522744 885093425 912206957 555405726 274506476 906876689 440830143 632292469 810436549 1230499920 829374097 566114132 885132335 116258468 917346408 399224170 707888414 649689023 354045889 428824222 1189896376 386749508 308205239 627226536 178946199 1029945463 598105815 ...

output:

NO

result:

ok IMPOSSIBLE

Test #35:

score: 0
Accepted
time: 83ms
memory: 20468kb

input:

999995
618092763 957206120 372970328 456622497 650529065 50472186 873269669 462346324 838397448 455115828 350283767 472310383 392777841 334382078 528569426 1342210470 308664912 323239617 913950711 429066250 1050446612 729535596 1135424230 731248362 619557309 327443312 252571339 762007751 908332952 1...

output:

NO

result:

ok IMPOSSIBLE

Subtask #2:

score: 0
Wrong Answer

Test #36:

score: 5
Accepted
time: 2ms
memory: 13892kb

input:

3
10 15 10
20 20
0 11

output:

YES
5
10 0 10
5 5 10

result:

ok good plan

Test #37:

score: 0
Accepted
time: 0ms
memory: 14000kb

input:

4
5 3 1 2
7 6 2
3 2 4

output:

YES
4
5 2 0
3 2 1
0 0 2

result:

ok good plan

Test #38:

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

input:

2
25 58
103
25

output:

YES
20
25 20 58

result:

ok good plan

Test #39:

score: 0
Accepted
time: 4ms
memory: 13904kb

input:

2
400 400
121
200

output:

YES
0
121 0 0

result:

ok good plan

Test #40:

score: 0
Accepted
time: 1ms
memory: 13860kb

input:

2000
98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 9...

output:

NO

result:

ok IMPOSSIBLE

Test #41:

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

input:

2000
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...

output:

NO

result:

ok IMPOSSIBLE

Test #42:

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

input:

2000
98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 98 9...

output:

NO

result:

ok IMPOSSIBLE

Test #43:

score: 0
Accepted
time: 4ms
memory: 13860kb

input:

2000
100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100...

output:

NO

result:

ok IMPOSSIBLE

Test #44:

score: -5
Wrong Answer
time: 2ms
memory: 13940kb

input:

2000
10 223 62 131 212 90 80 177 228 126 130 34 80 160 102 92 116 83 137 43 167 62 113 115 225 26 179 65 208 108 137 124 71 169 36 101 122 203 36 162 156 89 222 205 138 158 84 178 63 169 31 301 66 158 110 17 211 171 39 46 81 22 110 108 127 49 137 90 137 55 75 60 32 189 52 160 69 145 65 145 56 223 15...

output:

YES
95048
10 4 158
65 61 8
54 90 55
76 59 58
154 19 17
73 56 28
52 58 79
98 0 61
167 27 0
126 0 64
59 0 0
34 36 0
80 20 87
73 9 2
100 26 43
49 29 35
81 50 36
47 69 0
137 4 2
41 15 75
92 18 0
62 55 67
46 47 67
48 0 141
84 73 0
26 56 73
106 55 14
51 28 82
126 7 0
108 31 27
110 15 44
80 79 20
51 14 28
...

result:

wrong answer the cost you declared is 95048, but expected 94956

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%