QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#36129#4269. Rainy MarketsWuyanru25 ✓428ms27196kbC++174.6kb2022-06-24 15:05:052022-06-24 15:05:06

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 15:05:06]
  • 评测
  • 测评结果:25
  • 用时:428ms
  • 内存:27196kb
  • [2022-06-24 15:05:05]
  • 提交

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=n-1;i;i--)
    {
        int num2=min(buy[i],b[i+1]);ans-=num2;
        r[i]+=num2,b[i+1]-=num2,buy[i]-=num2;

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

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

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 5ms
memory: 13736kb

input:

3
10 15 10
20 20
0 0

output:

NO

result:

ok IMPOSSIBLE

Test #2:

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

input:

2
813741488 132495829
946237313
0

output:

YES
0
813741484 0 132495829

result:

ok good plan

Test #3:

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

input:

2
175700937 435906025
546265275
0

output:

YES
0
110359250 0 435906025

result:

ok good plan

Test #4:

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

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: 94ms
memory: 21172kb

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: 48ms
memory: 27048kb

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: 84ms
memory: 27076kb

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: 3ms
memory: 13984kb

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
371886511 0 345259827
386675452 0 362318195
66096292 0 473323587
405607255 0 180584510
388593638 0 458992209
367236609 0 575010426
425773486 0 355875397
330909154 0 379949786
130617921 0 56416131
146975598 0 157240292
75138781 0 770523955
580659914 0 33232625
395986545 0 459393364
308087462 0 ...

result:

ok good plan

Test #9:

score: 0
Accepted
time: 7ms
memory: 13932kb

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
157622270 0 140697311
0 0 807038955
0 0 223159716
179775292 0 240720875
139496739 0 827103054
62112513 0 500270094
352036607 0 396302703
575501090 0 239105283
1062512 0 156812678
0 0 221644650
0 0 997409553
243588141 0 569242231
439102541 0 375013493
65027649 0 623974894
0 0 290877953
14576618...

result:

ok good plan

Test #10:

score: 0
Accepted
time: 194ms
memory: 27092kb

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
6 0 4
0 0 7
0 0 9
0 0 6
5 0 5
1 0 3
0 0 8
6 0 3
0 0 6
0 0 10
0 0 7
3 0 6
0 0 10
3 0 7
0 0 9
3 0 5
0 0 3
0 0 7
0 0 8
0 0 10
3 0 3
0 0 8
1 0 8
3 0 6
0 0 7
2 0 7
1 0 9
0 0 5
0 0 10
0 0 7
8 0 2
0 0 3
3 0 3
0 0 6
0 0 7
0 0 8
5 0 1
5 0 2
0 0 4
0 0 4
1 0 8
0 0 7
0 0 10
0 0 2
0 0 8
3 0 6
0 0 6
6 0 2
0...

result:

ok good plan

Test #11:

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

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
10 0 55
0 0 45
39 0 39
49 0 33
61 0 32
20 0 6
10 0 84
0 0 3
25 0 52
16 0 83
42 0 57
53 0 17
0 0 18
8 0 77
26 0 44
2 0 80
13 0 73
19 0 48
40 0 17
10 0 78
0 0 47
55 0 41
58 0 38
28 0 21
8 0 75
0 0 69
0 0 34
15 0 38
24 0 70
4 0 75
34 0 45
17 0 63
25 0 38
8 0 76
7 0 78
53 0 29
0 0 99
60 0 30
0 0 8...

result:

ok good plan

Test #12:

score: 0
Accepted
time: 276ms
memory: 27116kb

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
119912928 0 587046890
0 0 111848903
518024837 0 421201086
140056213 0 302537107
391287131 0 172935477
222558807 0 389592511
412131996 0 317580166
243099000 0 211085998
152794970 0 103016537
0 0 373285082
265615025 0 187670984
175703838 0 166657081
280136224 0 176405935
784179445 0 181837377
0 ...

result:

ok good plan

Test #13:

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

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
0 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...

result:

ok good plan

Test #14:

score: 0
Accepted
time: 68ms
memory: 20660kb

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: 295ms
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
362545019 0 262256803
157174021 0 468485434
490824095 0 478738638
210862232 0 679754995
365012349 0 150709566
111698235 0 29167660
213558078 0 579157870
105005091 0 85218185
330902154 0 1600036
348493910 0 607084252
197917474 0 151116848
96386171 0 733640062
326888820 0 62628200
80893193 0 781...

result:

ok good plan

Test #16:

score: 0
Accepted
time: 375ms
memory: 27136kb

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
194088105 0 350433967
503232786 0 195864182
293947407 0 214538600
193541473 0 784470907
439530635 0 66713819
201346448 0 740509115
642157279 0 320573916
96682339 0 653212110
437273354 0 433754354
400841421 0 6052805
133684292 0 343734110
526120064 0 130071880
171239446 0 123928246
208336631 0 ...

result:

ok good plan

Test #17:

score: 0
Accepted
time: 326ms
memory: 27116kb

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
178089237 0 761818750
247300408 0 428789029
363536400 0 453187363
616341822 0 240478677
24279006 0 923101520
60857326 0 461887126
422200098 0 483322617
128837901 0 721127580
215029036 0 658768366
628234681 0 288219384
401801012 0 174225431
665168149 0 192990541
202492281 0 38587682
287485953 0...

result:

ok good plan

Test #18:

score: 0
Accepted
time: 300ms
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
12293457 0 245665657
412168741 0 433311351
32229495 0 161282712
550377992 0 48586163
30817680 0 545120093
349569651 0 429988690
165666370 0 686539454
519313325 0 453334254
516084605 0 88539448
14232584 0 772023670
125271282 0 615369874
276352099 0 365626185
378859237 0 305758914
372180438 0 30...

result:

ok good plan

Test #19:

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

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
99876747 0 645386498
296002479 0 226842378
75447798 0 840558344
57965128 0 933272420
81698029 0 46234478
66963951 0 641268273
293242812 0 365543759
35050763 0 558840444
49096823 0 70038956
209756626 0 406998863
524973342 0 31364111
315720470 0 464177472
574021097 0 67149219
911271905 0 7902002...

result:

ok good plan

Test #20:

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

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
55456465 0 198964677
22376798 0 616050344
63984376 0 704629287
671319231 0 297502880
428861992 0 547648729
0 0 46305705
186645899 0 162198731
641898396 0 213730683
262341064 0 400664764
243091005 0 516068390
771770228 0 134628679
122163378 0 69520076
403308999 0 17469924
658255458 0 286821687
...

result:

ok good plan

Test #21:

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

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
432913594 0 156419747
35909200 0 325313421
43943803 0 372781963
819243785 0 50296698
260868247 0 87879420
249615037 0 237192169
315660584 0 71784941
253366559 0 67475217
447871583 0 522749097
688843535 0 253702631
185835778 0 667012630
460725165 0 436769662
410970965 0 512025001
189753280 0 68...

result:

ok good plan

Test #22:

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

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
132467309 0 810198486
321713400 0 664647494
63971787 0 889858582
575053213 0 246965057
0 0 534899949
444790782 0 482984814
0 0 397295101
567397848 0 160683410
660014859 0 309216115
0 0 133233661
53455787 0 913698653
0 0 996200139
275996202 0 582149848
0 0 422917215
381637033 0 516109770
0 0 48...

result:

ok good plan

Test #23:

score: 0
Accepted
time: 278ms
memory: 27084kb

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
161090243 0 263764890
511952210 0 130989072
476424044 0 261270523
268181182 0 404314381
324258370 0 112312586
713754188 0 139358368
356968249 0 211680311
408501704 0 587194480
268901311 0 453110479
137891379 0 473507059
205621960 0 241621220
525224586 0 396691528
716691536 0 35673825
282464009...

result:

ok good plan

Test #24:

score: 0
Accepted
time: 274ms
memory: 27148kb

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
463678037 0 404392091
713892210 0 119496218
345047838 0 406070874
491122052 0 174743583
0 0 220962716
196030489 0 657525923
327827511 0 671231982
532195179 0 399939697
508511926 0 216865901
100785135 0 82802791
110831865 0 384285991
616726972 0 232975465
41733195 0 582058819
28309871 0 9560053...

result:

ok good plan

Test #25:

score: 0
Accepted
time: 78ms
memory: 20264kb

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: 91ms
memory: 19808kb

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: 284ms
memory: 27132kb

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
518522152 0 88344207
803486195 0 151090449
363316580 0 377886009
277389123 0 714940269
190988310 0 400679908
265246044 0 11750899
443874886 0 514286041
147347448 0 543005970
247517394 0 509071971
497954648 0 63785067
297866007 0 213975303
190431904 0 239200173
372080530 0 43996487
240743014 0 ...

result:

ok good plan

Test #28:

score: 0
Accepted
time: 301ms
memory: 27136kb

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
727218128 0 220232418
0 0 523936692
0 0 854670028
0 0 621190575
411369806 0 518391240
0 0 772080186
338541993 0 626892853
538415112 0 404153101
680086152 0 285442269
35891043 0 524235556
166548114 0 476983877
153469450 0 234669251
511230990 0 454383599
83940511 0 542683515
0 0 796241833
0 0 66...

result:

ok good plan

Test #29:

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

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: 287ms
memory: 27116kb

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
88132617 0 57493967
190521493 0 274080144
871847658 0 72190409
152617985 0 150436954
322627076 0 423410884
320569002 0 199815035
177581009 0 547893567
456450243 0 375251958
105932350 0 10217001
742686065 0 111302199
313307621 0 139182844
292832879 0 46020378
743318953 0 182787279
291110453 0 8...

result:

ok good plan

Test #31:

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

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
0 0 27565033
835517398 0 133940776
0 0 392672031
560978915 0 271761506
435213032 0 346845213
338969119 0 183916779
0 0 227606592
152079762 0 532121358
0 0 233751068
0 0 970162480
65601023 0 717116139
217498692 0 186713540
188073498 0 290101599
402656357 0 231768059
293468322 0 151565344
612957...

result:

ok good plan

Test #32:

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

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
217955262 0 348776390
664129933 0 301210174
305483691 0 294154488
647788777 0 93246944
182272649 0 182310127
598650811 0 229647348
68378820 0 434633216
474686435 0 335962330
406990929 0 402072756
611289519 0 344978428
701074193 0 34690457
135293421 0 572995250
732575645 0 131251457
192399324 0...

result:

ok good plan

Test #33:

score: 0
Accepted
time: 103ms
memory: 20540kb

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: 91ms
memory: 21108kb

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: 88ms
memory: 19716kb

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: 5
Accepted

Test #36:

score: 5
Accepted
time: 1ms
memory: 13836kb

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: 4ms
memory: 13800kb

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: 1ms
memory: 14000kb

input:

2
25 58
103
25

output:

YES
20
25 20 58

result:

ok good plan

Test #39:

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

input:

2
400 400
121
200

output:

YES
0
0 0 121

result:

ok good plan

Test #40:

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

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: 13844kb

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: 3ms
memory: 13796kb

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: 5ms
memory: 14008kb

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: 0
Accepted
time: 2ms
memory: 13896kb

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
94956
10 4 158
65 61 8
54 90 55
76 59 58
154 19 17
73 56 28
52 58 79
98 10 51
177 10 7
119 0 71
59 0 0
34 36 0
80 20 87
73 9 2
100 26 43
49 29 35
81 66 20
63 53 0
137 4 2
41 30 60
107 3 0
62 55 67
46 47 67
48 15 126
99 58 0
26 56 73
106 55 14
51 35 75
133 0 0
108 31 27
110 15 44
80 79 20
51 28 1...

result:

ok good plan

Test #45:

score: 0
Accepted
time: 3ms
memory: 13932kb

input:

2000
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 174
0 0 125
0 0 171
0 0 172
0 0 186
0 0 179
0 0 179
0 0 168
0 0 148
0 0 158
0 0 139
0 0 191
0 0 156
0 0 200
0 0 68
0 0 113
0 0 92
0 0 159
0 0 67
0 0 186
0 0 124
0 0 143
0 0 89
0 0 133
0 0 82
0 0 107
0 0 133
0 0 178
0 0 155
0 0 199
0 0 109
0 0 147
0 0 149
0 0 180
0 0 186
0 0 185
0 0 188
0 0...

result:

ok good plan

Test #46:

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

input:

2000
7 6 7 3 7 4 13 8 3 0 4 9 7 5 1 13 3 9 3 9 3 3 6 4 9 5 12 1 3 7 5 6 4 4 11 4 4 4 3 11 2 9 12 4 3 4 7 6 6 10 7 6 9 10 8 6 8 8 6 7 2 5 10 5 5 5 6 5 9 4 7 5 8 3 9 12 13 4 10 3 4 7 3 6 6 7 7 4 8 3 6 2 5 2 6 7 4 5 11 7 2 4 10 2 7 8 8 1 8 10 5 8 1 6 11 4 10 10 3 1 9 6 9 13 5 4 10 5 8 9 3 6 2 9 7 6 8 1...

output:

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

result:

ok good plan

Test #47:

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

input:

2000
0 89 52 43 65 39 19 48 66 50 64 29 63 46 28 49 71 112 18 61 36 12 53 86 37 48 22 75 57 43 9 7 82 38 66 8 97 11 74 17 49 86 33 42 86 43 32 46 8 41 39 70 89 34 32 44 30 53 10 50 89 63 48 93 34 5 84 18 55 33 63 76 50 57 36 60 42 46 75 67 36 25 62 28 78 79 53 46 78 65 20 35 60 88 24 31 36 7 90 24 6...

output:

YES
44597
0 6 54
35 8 28
24 8 0
43 17 6
59 12 10
29 7 0
19 18 13
35 11 41
25 57 17
33 18 3
61 14 0
29 45 17
46 4 0
46 36 0
28 27 22
27 30 39
32 4 64
48 0 0
18 46 14
47 12 0
36 54 0
12 55 32
21 50 8
78 4 15
22 71 5
43 6 0
22 38 40
35 0 26
31 0 0
43 29 0
9 62 0
7 10 34
48 28 5
33 58 0
66 11 0
8 8 37
6...

result:

ok good plan

Test #48:

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

input:

2000
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 148
0 0 163
0 0 172
0 0 175
0 0 140
0 0 180
0 0 166
0 0 173
0 0 180
0 0 165
0 0 158
0 0 173
0 0 61
0 0 146
0 0 88
0 0 179
0 0 186
0 0 135
0 0 196
0 0 39
0 0 155
0 0 145
0 0 100
0 0 163
0 0 197
0 0 194
0 0 131
0 0 137
0 0 88
0 0 89
0 0 134
0 0 178
0 0 179
0 0 136
0 0 118
0 0 192
0 0 115
0 0...

result:

ok good plan

Test #49:

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

input:

2000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

NO

result:

ok IMPOSSIBLE

Test #50:

score: 0
Accepted
time: 3ms
memory: 14004kb

input:

1992
58 65 88 132 109 131 80 80 83 9 188 66 107 58 47 133 95 126 121 81 138 100 65 17 112 118 186 51 99 132 62 230 49 112 92 70 166 174 77 88 184 87 156 90 85 59 29 174 46 174 57 151 92 93 67 82 139 89 72 92 154 73 92 187 94 118 134 140 157 78 130 59 141 61 77 199 114 282 14 122 78 223 31 76 132 118...

output:

YES
86734
58 27 36
29 30 40
48 85 0
132 12 46
63 15 34
97 10 24
56 113 0
80 48 14
69 87 0
9 49 129
59 114 21
45 106 2
105 65 0
58 72 0
47 26 77
56 14 0
95 49 16
110 44 26
95 43 0
81 54 44
94 5 63
37 0 0
65 100 0
17 95 18
94 19 79
39 24 37
149 5 0
51 144 4
95 25 43
89 0 0
62 1 89
141 41 0
49 26 22
90...

result:

ok good plan

Test #51:

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

input:

1994
40 109 77 136 31 156 170 131 133 165 264 92 166 39 120 196 25 157 63 135 92 190 137 86 130 106 29 83 91 122 133 146 304 127 94 76 185 62 108 168 26 121 128 139 158 199 73 119 209 110 178 109 34 92 29 86 172 19 102 27 302 171 77 152 80 44 148 132 74 167 97 107 130 52 121 188 115 105 179 133 121 ...

output:

YES
52708
40 110 0
109 81 0
77 68 0
136 2 0
31 11 44
112 0 0
170 0 25
106 0 73
60 0 60
105 0 85
179 0 0
92 89 0
166 7 0
39 32 21
99 16 53
143 0 0
25 20 106
51 0 0
63 79 26
109 0 0
92 3 57
133 10 32
105 0 0
86 33 0
130 10 0
106 51 0
29 15 0
83 22 0
91 34 12
110 0 46
87 0 84
62 0 128
176 0 13
114 0 23...

result:

ok good plan

Test #52:

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

input:

1991
177 118 253 71 45 174 71 168 213 116 129 260 126 134 203 120 131 208 174 155 90 76 245 210 185 133 50 157 262 100 220 124 83 183 258 158 142 256 200 139 148 80 178 160 123 187 90 226 82 68 203 82 100 95 238 78 119 103 144 208 128 165 153 123 105 193 91 93 122 277 174 139 66 80 106 143 166 126 1...

output:

YES
12019
154 0 42
76 0 55
198 0 0
71 1 0
45 120 8
166 0 0
71 27 72
96 0 102
111 0 75
41 0 124
5 0 132
128 0 48
78 0 120
14 0 55
148 0 4
116 0 0
131 40 18
190 0 0
174 7 18
137 0 7
83 0 76
0 0 161
44 0 149
61 0 103
82 0 35
98 0 38
12 0 141
16 0 175
87 0 100
0 0 127
58 0 93
31 0 83
0 0 156
0 0 197
6 0...

result:

ok good plan

Test #53:

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

input:

1999
400 400 400 400 400 195 382 287 400 400 400 145 400 400 316 400 400 400 400 400 400 400 203 400 400 400 400 92 400 400 400 400 400 400 400 400 400 400 400 400 400 321 332 400 400 214 400 249 337 400 400 400 253 400 400 225 400 400 400 400 400 345 369 400 400 73 400 296 196 235 289 400 400 400 4...

output:

YES
0
0 0 169
0 0 69
0 0 176
0 0 114
0 0 186
0 0 180
0 0 179
0 0 165
0 0 81
0 0 192
1 0 145
0 0 125
0 0 184
0 0 148
0 0 78
0 0 183
0 0 165
0 0 141
0 0 194
0 0 145
0 0 75
0 0 185
0 0 182
0 0 196
0 0 101
0 0 178
50 0 92
0 0 151
0 0 50
0 0 137
0 0 191
0 0 154
0 0 180
0 0 74
0 0 148
0 0 143
0 0 138
0 0 ...

result:

ok good plan

Test #54:

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

input:

1995
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 138 400 222 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 197
0 0 150
0 0 122
0 0 133
0 0 191
0 0 20
0 0 119
0 0 102
0 0 154
0 0 194
0 0 84
0 0 143
0 0 122
0 0 78
0 0 175
0 0 170
0 0 150
0 0 183
0 0 137
0 0 73
0 0 156
0 0 148
0 0 125
0 0 98
0 0 145
0 0 64
0 0 187
0 0 156
0 0 159
0 0 167
0 0 77
0 0 142
0 0 142
0 0 198
0 0 172
0 0 150
0 0 51
0 0 18...

result:

ok good plan

Test #55:

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

input:

1991
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 161
0 0 155
0 0 174
0 0 164
0 0 168
0 0 121
0 0 132
0 0 185
0 0 189
0 0 180
0 0 149
0 0 169
0 0 99
0 0 199
0 0 196
0 0 147
0 0 194
0 0 118
0 0 144
0 0 93
0 0 89
0 0 127
0 0 180
0 0 195
0 0 148
0 0 127
0 0 191
0 0 173
0 0 167
0 0 176
0 0 175
0 0 154
0 0 165
0 0 178
0 0 193
0 0 85
0 0 149
0 ...

result:

ok good plan

Test #56:

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

input:

1994
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 184
0 0 200
0 0 152
0 0 189
0 0 156
0 0 196
0 0 182
0 0 168
0 0 154
0 0 59
0 0 138
0 0 116
0 0 200
0 0 146
0 0 199
0 0 194
0 0 190
0 0 165
0 0 187
0 0 141
0 0 176
0 0 128
0 0 142
0 0 183
0 0 93
0 0 152
0 0 108
0 0 80
0 0 69
0 0 180
0 0 174
0 0 136
0 0 170
0 0 177
0 0 181
0 0 176
0 0 187
0 ...

result:

ok good plan

Test #57:

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

input:

1994
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 152
0 0 92
0 0 176
0 0 164
0 0 190
0 0 173
0 0 200
0 0 140
0 0 145
0 0 166
0 0 53
0 0 130
0 0 163
0 0 184
0 0 131
0 0 170
0 0 113
0 0 198
0 0 177
0 0 185
0 0 165
0 0 99
0 0 179
0 0 60
0 0 75
0 0 153
0 0 186
0 0 135
0 0 175
0 0 164
0 0 112
0 0 149
0 0 200
0 0 161
0 0 182
0 0 190
0 0 155
0 0...

result:

ok good plan

Test #58:

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

input:

1998
30 53 270 141 74 115 132 74 65 79 93 47 125 95 144 134 168 20 187 85 94 147 42 163 199 104 54 168 36 42 102 113 119 50 98 111 1 130 164 205 84 104 164 117 135 39 79 75 39 268 23 194 124 155 66 131 79 222 139 66 127 121 139 43 71 115 31 146 139 135 169 89 65 83 218 97 38 43 196 59 182 73 49 37 6...

output:

YES
96854
30 129 33
20 10 160
110 39 27
114 24 13
61 94 38
77 55 32
100 31 31
43 98 18
47 62 57
22 2 1
92 9 11
36 77 19
106 50 28
67 24 65
79 79 38
96 21 73
95 25 0
20 8 16
171 27 0
85 71 27
67 78 44
103 10 0
42 16 100
63 80 47
152 18 7
97 44 46
8 144 26
142 52 0
36 47 2
40 5 74
28 116 7
106 16 16
1...

result:

ok good plan

Test #59:

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

input:

1998
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 148
0 0 187
0 0 187
0 0 63
0 0 183
0 0 53
0 0 178
0 0 164
0 0 188
0 0 178
0 0 145
0 0 169
0 0 190
0 0 173
0 0 159
0 0 190
0 0 88
0 0 186
0 0 164
0 0 154
0 0 92
0 0 179
0 0 180
0 0 131
0 0 161
0 0 163
0 0 161
0 0 184
0 0 197
0 0 181
0 0 108
0 0 193
0 0 177
0 0 178
0 0 194
0 0 118
0 0 176
0 ...

result:

ok good plan

Test #60:

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

input:

1993
111 103 153 61 133 112 55 99 111 130 30 144 124 24 56 113 189 84 161 129 46 119 18 93 73 205 12 8 75 59 198 8 106 62 122 127 95 129 118 104 94 36 125 187 69 28 85 37 187 35 117 112 54 165 103 134 83 144 160 46 67 16 99 194 25 31 70 24 45 138 185 43 34 160 213 97 195 104 80 46 159 58 104 161 67 ...

output:

NO

result:

ok IMPOSSIBLE

Test #61:

score: 0
Accepted
time: 3ms
memory: 13836kb

input:

1993
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

NO

result:

ok IMPOSSIBLE

Test #62:

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

input:

1998
13 133 172 15 139 128 135 89 124 30 170 141 64 48 163 42 193 38 45 111 158 142 97 44 115 120 144 222 194 99 80 173 66 203 77 54 120 43 68 100 45 77 159 126 131 62 154 273 109 45 79 10 42 54 150 123 93 187 90 125 128 92 140 61 178 3 209 219 112 140 18 47 36 56 170 41 141 185 32 122 121 163 158 5...

output:

YES
94941
13 88 91
42 6 120
52 37 0
15 61 73
66 14 19
109 31 46
89 31 42
47 57 86
38 108 0
30 12 134
36 48 74
67 26 3
61 5 13
35 2 90
73 120 0
42 27 83
110 71 0
38 58 0
45 48 73
38 138 6
152 1 19
123 6 45
52 28 4
40 131 28
87 8 0
120 31 37
107 0 90
132 0 42
152 0 0
99 5 4
76 31 61
112 27 1
65 44 72
...

result:

ok good plan

Test #63:

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

input:

1998
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 115
0 0 182
0 0 193
0 0 166
0 0 175
0 0 181
0 0 199
0 0 155
0 0 176
0 0 160
0 0 133
0 0 114
0 0 130
0 0 187
0 0 196
0 0 181
0 0 83
0 0 196
0 0 139
0 0 157
0 0 186
0 0 154
0 0 98
0 0 104
0 0 74
0 0 167
0 0 178
0 0 61
0 0 161
0 0 185
0 0 142
0 0 154
0 0 195
0 0 114
0 0 186
0 0 186
0 0 119
0 ...

result:

ok good plan

Test #64:

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

input:

1997
20 209 70 89 33 26 70 153 123 162 58 74 128 36 55 76 118 106 112 135 105 102 74 66 135 210 54 24 178 127 52 179 88 113 98 53 33 141 244 50 51 201 74 148 147 114 105 230 77 31 76 159 257 141 62 166 79 61 32 162 87 118 156 168 206 29 67 51 90 122 72 94 163 42 184 56 76 53 73 108 54 43 32 156 140 ...

output:

YES
102371
20 41 40
169 12 7
63 131 2
87 48 17
16 98 9
17 37 52
18 36 142
11 54 101
22 23 133
29 112 25
33 20 3
71 11 56
72 77 8
28 128 13
42 58 45
31 16 118
0 74 41
65 11 91
21 51 80
55 41 9
96 7 58
44 34 43
31 78 51
15 61 112
23 77 75
135 13 15
39 76 6
18 77 102
76 21 41
86 17 20
32 49 72
107 14 4...

result:

ok good plan

Test #65:

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

input:

1992
30 105 77 138 113 48 121 33 128 39 61 171 101 189 53 24 145 31 184 36 87 108 145 59 47 209 138 48 169 14 137 78 30 84 113 53 133 135 167 76 131 62 150 72 47 130 72 157 27 61 136 213 74 88 119 108 108 99 183 84 77 112 38 146 84 96 90 203 72 95 119 69 51 164 161 44 80 93 83 122 115 163 91 107 59 ...

output:

YES
94716
30 151 13
92 51 14
63 18 33
105 25 52
61 67 21
27 26 76
45 101 0
33 5 55
73 96 0
39 71 15
46 42 82
89 36 38
63 6 83
106 29 26
27 162 0
24 17 79
66 89 9
22 18 78
106 61 13
23 56 41
46 64 80
28 22 0
145 47 0
59 109 3
44 98 52
157 20 16
122 4 10
38 111 46
123 0 0
14 117 13
124 74 2
76 92 10
2...

result:

ok good plan

Test #66:

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

input:

1992
400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400 400...

output:

YES
0
0 0 148
0 0 34
0 0 56
0 0 82
0 0 172
0 0 153
0 0 125
0 0 48
0 0 196
0 0 127
0 0 153
0 0 188
0 0 185
0 0 182
0 0 160
0 0 157
0 0 113
0 0 186
0 0 200
0 0 93
0 0 171
0 0 176
0 0 131
0 0 175
0 0 166
0 0 133
0 0 126
0 0 140
0 0 76
0 0 114
0 0 84
0 0 172
0 0 145
0 0 110
0 0 158
0 0 158
0 0 192
0 0 1...

result:

ok good plan

Test #67:

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

input:

1998
23 88 59 103 116 146 120 15 101 274 147 97 119 117 60 45 86 108 123 207 66 202 86 157 17 37 168 45 107 13 7 117 120 62 71 82 149 48 93 131 19 104 62 67 162 23 44 64 82 82 43 222 95 41 174 28 104 131 68 148 13 21 78 109 73 189 96 69 87 121 85 142 106 154 79 205 56 209 30 25 51 189 80 55 53 97 93...

output:

YES
95537
23 93 82
6 74 0
59 37 75
28 5 29
87 70 8
138 8 0
120 0 0
15 102 82
19 43 96
178 6 0
147 38 9
88 52 0
119 3 3
114 53 0
60 35 10
35 12 15
71 45 58
50 58 92
31 28 40
167 28 0
66 8 108
94 57 0
86 8 35
122 72 0
17 57 18
19 25 139
29 33 0
45 78 39
68 6 3
10 140 0
7 114 68
49 104 12
108 31 20
42 ...

result:

ok good plan

Test #68:

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

input:

1998
400 400 400 0 400 400 400 400 0 0 400 400 400 400 400 0 0 400 0 400 0 400 0 0 400 400 400 400 400 400 400 400 400 400 0 0 400 400 0 0 400 400 0 400 0 0 0 400 0 0 400 400 400 400 400 400 400 0 400 400 400 400 400 400 400 0 400 400 400 400 0 0 400 0 400 400 0 400 400 0 400 0 0 0 400 0 400 400 400...

output:

NO

result:

ok IMPOSSIBLE

Test #69:

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

input:

1996
65 88 89 115 168 11 186 63 175 36 168 167 32 140 43 122 132 111 67 40 201 24 11 149 12 22 87 99 109 78 208 63 51 195 69 156 28 111 97 115 39 132 44 88 93 173 118 19 109 102 118 139 96 27 267 155 65 36 97 65 141 72 155 59 150 15 28 175 13 206 58 42 172 108 97 40 9 163 115 161 92 132 78 91 152 32...

output:

NO

result:

ok IMPOSSIBLE

Test #70:

score: 0
Accepted
time: 3ms
memory: 13944kb

input:

1996
0 0 0 0 0 400 0 400 0 0 0 0 0 0 400 0 0 400 400 0 400 0 0 0 0 0 0 0 400 0 0 400 0 0 0 0 0 0 400 0 400 0 0 0 400 0 0 0 0 400 0 400 400 400 400 0 400 0 400 0 0 0 0 400 0 0 400 0 400 0 400 0 0 400 0 0 0 400 0 0 400 0 0 400 400 0 0 400 0 0 0 0 0 0 400 0 0 0 0 400 0 400 400 0 0 0 0 400 400 0 0 0 0 4...

output:

NO

result:

ok IMPOSSIBLE

Subtask #3:

score: 6
Accepted

Dependency #2:

100%
Accepted

Test #71:

score: 6
Accepted
time: 3ms
memory: 13952kb

input:

3998
230 1491 1015 571 1449 269 1501 1440 527 1181 1429 753 832 1024 523 505 719 355 517 1695 546 2054 343 1775 1008 2788 903 1443 1509 1401 1003 807 1323 1733 434 1174 549 608 1302 665 972 1433 1399 1477 518 838 839 1206 2093 116 536 134 454 1527 2107 1596 1120 960 371 254 633 335 660 1332 707 2002...

output:

YES
1976153
230 1042 452
1039 37 145
870 848 31
540 830 397
1052 79 190
79 87 652
849 219 179
1261 243 0
527 1312 69
1112 73 800
629 734 290
463 89 706
126 1031 639
385 1561 0
523 689 290
215 1201 411
308 289 118
237 406 380
137 272 873
822 539 167
379 283 757
1297 271 73
270 54 1643
132 535 669
339...

result:

ok good plan

Test #72:

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

input:

3998
4000 4000 4000 0 4000 4000 4000 4000 0 0 4000 4000 0 4000 4000 4000 0 0 4000 0 4000 0 0 4000 4000 4000 4000 4000 0 0 4000 4000 4000 4000 0 0 4000 4000 4000 4000 0 4000 4000 4000 4000 0 4000 0 0 0 4000 0 0 4000 4000 0 4000 4000 4000 4000 0 4000 0 0 0 0 4000 0 4000 4000 4000 0 0 4000 4000 4000 0 ...

output:

NO

result:

ok IMPOSSIBLE

Test #73:

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

input:

3996
65 1856 852 2204 649 950 1577 1432 742 381 1627 737 424 232 829 258 494 196 1439 1323 201 787 675 965 1587 792 1591 682 1316 1028 674 607 904 1367 338 796 764 449 2341 554 1118 1602 920 307 2227 318 865 152 1114 2048 718 263 2248 729 803 1907 1015 1262 657 1499 1721 921 1460 1110 646 403 1582 2...

output:

NO

result:

ok IMPOSSIBLE

Test #74:

score: 0
Accepted
time: 3ms
memory: 13848kb

input:

3996
4000 0 0 0 0 4000 0 4000 4000 4000 0 0 0 0 4000 0 0 4000 0 0 4000 0 0 4000 4000 0 0 0 4000 0 4000 0 0 0 0 0 0 0 0 0 4000 4000 0 0 0 0 0 0 4000 0 4000 0 0 0 4000 0 4000 0 0 4000 0 0 0 0 4000 0 0 0 0 4000 4000 4000 4000 4000 0 0 0 0 0 0 0 0 4000 0 0 0 0 0 0 0 0 0 0 0 0 4000 0 0 0 4000 0 0 0 4000 ...

output:

NO

result:

ok IMPOSSIBLE

Test #75:

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

input:

2
981 353
1750
422

output:

YES
416
981 416 353

result:

ok good plan

Test #76:

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

input:

2
4000 4000
1367
2000

output:

YES
0
0 0 1367

result:

ok good plan

Test #77:

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

input:

4000
998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998...

output:

NO

result:

ok IMPOSSIBLE

Test #78:

score: 0
Accepted
time: 3ms
memory: 13988kb

input:

4000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

NO

result:

ok IMPOSSIBLE

Test #79:

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

input:

4000
998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998 998...

output:

NO

result:

ok IMPOSSIBLE

Test #80:

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

input:

4000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

NO

result:

ok IMPOSSIBLE

Test #81:

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

input:

4000
93 1491 1080 198 1354 690 592 505 599 872 2375 390 1273 863 2171 361 1262 1541 289 293 772 622 728 764 543 1770 951 886 1210 275 1440 2002 867 1199 1756 52 1057 1805 1516 1739 794 1521 1696 738 1124 604 927 1770 343 1353 389 1266 1533 808 761 1085 494 512 149 1267 1357 2205 881 384 1763 895 107...

output:

YES
2040532
93 123 1433
58 386 863
217 770 90
108 174 957
397 206 132
558 431 534
58 1513 47
458 8 344
255 478 345
527 328 965
1410 56 104
286 745 916
357 936 561
302 282 998
1173 637 0
361 169 659
603 397 354
1187 582 99
190 1212 160
133 912 609
163 919 354
268 679 418
310 1052 357
407 1267 256
287...

result:

ok good plan

Test #82:

score: 0
Accepted
time: 3ms
memory: 13988kb

input:

4000
4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 ...

output:

YES
0
0 0 1319
0 0 923
0 0 915
0 0 1451
0 0 1963
0 0 1730
0 0 1746
0 0 1942
0 0 1561
0 0 1728
0 0 1800
0 0 1966
0 0 1996
0 0 1888
0 0 598
0 0 1750
0 0 1290
0 0 698
0 0 1553
0 0 1098
0 0 1939
0 0 1886
0 0 1899
0 0 1832
0 0 1930
0 0 1249
0 0 1982
0 0 1973
0 0 1295
0 0 1979
0 0 1860
0 0 716
0 0 1923
0 ...

result:

ok good plan

Test #83:

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

input:

4000
5 2 9 12 2 4 4 4 7 13 2 15 6 1 1 6 7 3 5 9 14 6 3 6 1 4 5 8 10 4 11 5 2 7 4 3 2 9 8 5 6 6 11 2 9 3 4 3 7 2 10 5 6 5 11 2 1 9 9 8 1 2 3 2 3 2 6 0 9 4 15 1 3 9 4 4 5 7 2 5 10 8 9 5 11 2 7 2 2 5 9 7 4 2 13 4 5 5 2 1 11 4 5 7 0 10 9 5 5 5 8 11 3 7 11 3 8 4 5 5 5 3 5 6 6 10 1 7 4 8 4 8 6 1 6 7 5 5 8...

output:

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

result:

ok good plan

Test #84:

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

input:

4000
15 12 93 69 35 32 58 60 63 64 58 45 60 40 39 49 34 44 40 56 92 28 36 14 31 38 82 50 48 46 22 52 66 66 82 43 16 59 82 21 85 44 10 41 118 35 30 35 52 93 11 54 32 57 47 54 82 22 56 63 51 12 98 29 10 128 13 40 44 123 80 94 12 54 47 9 66 25 75 39 52 83 31 48 23 66 98 54 50 19 91 46 99 49 64 55 29 52...

output:

YES
91417
15 61 4
8 46 36
57 31 0
69 9 0
35 6 8
24 8 26
32 21 0
60 6 20
43 7 34
30 0 0
58 11 15
30 16 21
39 18 0
40 33 4
35 35 14
35 7 14
20 22 2
42 51 0
40 21 21
35 0 46
46 0 0
28 25 16
20 38 0
14 79 6
25 33 15
23 13 43
39 55 6
44 9 9
39 29 0
46 20 0
22 43 9
43 6 20
46 0 0
66 16 17
65 0 0
43 2 0
16...

result:

ok good plan

Test #85:

score: 0
Accepted
time: 3ms
memory: 13892kb

input:

4000
4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 ...

output:

YES
0
0 0 1901
0 0 1256
0 0 1311
0 0 767
0 0 1750
0 0 1548
0 0 1359
0 0 1660
0 0 961
0 0 1972
0 0 723
0 0 231
0 0 1142
0 0 1197
0 0 1879
0 0 1984
0 0 1695
0 0 1861
0 0 1347
0 0 1709
0 0 1477
0 0 1720
0 0 1130
0 0 1911
0 0 1266
0 0 603
0 0 972
0 0 760
0 0 1595
0 0 609
0 0 1766
0 0 793
0 0 1825
0 0 14...

result:

ok good plan

Test #86:

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

input:

4000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

NO

result:

ok IMPOSSIBLE

Test #87:

score: 0
Accepted
time: 6ms
memory: 13940kb

input:

3992
132 261 821 682 1377 171 604 182 1568 817 587 1005 1423 1212 964 1426 1763 631 705 796 877 865 614 597 836 442 832 1050 435 529 1097 1423 837 371 1067 415 2113 467 1011 1791 606 1105 1309 1870 2198 370 1933 1650 481 917 1818 1405 1085 599 488 222 2132 1164 1626 496 2276 431 440 1330 432 1425 84...

output:

YES
2009692
132 909 111
150 815 280
541 745 626
56 718 814
563 0 0
171 158 567
37 487 32
150 58 1378
190 1215 129
688 937 0
587 509 711
294 1251 449
974 23 888
324 260 769
195 335 912
514 765 449
1314 41 327
304 330 146
559 392 78
718 347 301
576 566 0
865 572 243
371 971 272
325 1294 286
550 723 11...

result:

ok good plan

Test #88:

score: 0
Accepted
time: 3ms
memory: 13840kb

input:

3994
865 743 1905 1333 1477 1010 1981 375 1202 798 192 773 808 1578 1248 566 1573 1395 1470 579 357 926 573 1174 1799 1118 834 811 1426 830 797 1232 701 683 2683 665 1069 670 1087 1420 327 2136 508 1315 684 262 1716 532 935 892 1101 1055 1154 781 347 961 2015 583 342 385 1563 883 398 1417 698 2582 1...

output:

YES
1899306
865 431 396
347 173 1279
626 617 673
660 272 806
671 1085 141
869 431 282
1699 210 0
375 1270 0
1202 70 0
798 417 15
177 1155 0
773 258 60
748 109 684
894 505 513
735 693 0
566 386 647
926 283 655
740 833 180
1290 628 0
579 658 0
357 738 264
662 55 0
573 821 557
617 162 1136
663 479 508
...

result:

ok good plan

Test #89:

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

input:

3991
62 1409 699 994 270 2286 848 1037 692 777 533 974 1803 669 1711 548 1761 1419 796 2144 384 1499 2071 1161 1753 511 892 463 1552 755 1359 210 1206 973 663 932 108 1551 2250 751 1208 458 875 624 721 2155 1406 1347 1044 803 1189 515 957 1340 724 787 364 276 447 1971 916 1056 1545 981 757 638 520 7...

output:

YES
1802848
62 301 1081
328 512 225
474 686 430
564 835 0
270 270 1034
1252 230 0
848 259 68
969 887 0
692 689 0
777 995 89
444 118 349
625 0 350
1453 0 0
669 209 843
868 951 0
548 824 97
1664 281 0
1419 99 0
796 187 263
1881 40 0
384 315 777
722 314 521
1550 267 0
1161 413 213
1540 460 0
511 897 26...

result:

ok good plan

Test #90:

score: 0
Accepted
time: 3ms
memory: 13952kb

input:

3999
622 425 1700 1430 1565 1769 1755 1047 1081 1588 1752 2198 511 862 2402 2143 911 1797 1847 1609 2147 2340 1567 1858 1195 757 853 952 1715 1413 1898 1300 1877 1273 1878 1957 1365 1485 1383 1381 1715 2548 1394 2542 805 841 1746 911 1656 1103 894 2329 2300 1297 625 1216 1821 1604 2052 441 1279 1772...

output:

YES
257731
622 1343 0
425 915 75
1625 162 0
1430 13 0
1565 64 289
1480 0 0
1755 46 0
1047 342 0
1081 587 0
1588 149 192
1560 0 368
1830 0 0
511 209 862
0 0 1989
210 0 1765
378 0 882
29 0 1797
0 0 1598
0 0 1372
0 0 1094
360 0 1475
865 0 465
1102 0 743
1115 0 0
1195 8 486
271 0 33
820 0 952
0 0 442
79...

result:

ok good plan

Test #91:

score: 0
Accepted
time: 6ms
memory: 13984kb

input:

3995
4000 4000 2499 4000 4000 3648 2721 4000 729 4000 3554 2710 4000 4000 4000 4000 4000 4000 4000 4000 2610 4000 4000 4000 2750 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 3960 3902 3841 4000 4000 3620 4000 3601 666 4000 4000 3411 4000 4000 4000 4000 4000 4000 4000 4000 4000 3152 3872 4000 40...

output:

YES
0
0 0 1186
0 0 1320
0 0 1704
0 0 1705
0 0 1315
0 0 1877
0 0 1838
573 0 729
0 0 1868
0 0 1540
0 0 1674
0 0 1998
0 0 1764
0 0 1660
0 0 1919
0 0 1498
0 0 1150
0 0 1129
0 0 1181
0 0 1996
0 0 1734
0 0 1528
0 0 1178
0 0 1895
0 0 1193
0 0 1772
0 0 927
0 0 1721
0 0 1804
0 0 1133
0 0 1312
0 0 1949
0 0 17...

result:

ok good plan

Test #92:

score: 0
Accepted
time: 3ms
memory: 13948kb

input:

3991
4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 1725 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 ...

output:

YES
0
0 0 1194
0 0 1714
0 0 1506
0 0 1638
0 0 1873
0 0 1659
0 0 882
0 0 1902
0 0 1837
0 0 1898
0 0 1585
0 0 1610
0 0 1724
0 0 814
0 0 691
0 0 1614
0 0 974
0 0 1657
0 0 1219
0 0 1983
0 0 669
0 0 1704
0 0 1851
0 0 1564
0 0 1940
0 0 1679
0 0 1304
0 0 1887
0 0 1858
0 0 1624
0 0 909
0 0 1591
0 0 804
0 0 ...

result:

ok good plan

Test #93:

score: 0
Accepted
time: 3ms
memory: 13936kb

input:

3994
4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 ...

output:

YES
0
0 0 1687
0 0 576
0 0 1251
0 0 1296
0 0 1410
0 0 1542
0 0 1775
0 0 1820
0 0 1818
0 0 1959
0 0 1163
0 0 1660
0 0 687
0 0 616
0 0 928
0 0 997
0 0 572
0 0 744
0 0 1588
0 0 1950
0 0 1637
0 0 1860
0 0 754
0 0 1410
0 0 1682
0 0 1940
0 0 1173
0 0 1233
0 0 1212
0 0 1644
0 0 1711
0 0 1838
0 0 1908
0 0 1...

result:

ok good plan

Test #94:

score: 0
Accepted
time: 6ms
memory: 13984kb

input:

3994
4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 ...

output:

YES
0
0 0 1867
0 0 1571
0 0 911
0 0 1767
0 0 1333
0 0 1475
0 0 1862
0 0 1588
0 0 1170
0 0 1761
0 0 1691
0 0 1284
0 0 886
0 0 1835
0 0 1761
0 0 1357
0 0 1818
0 0 988
0 0 1820
0 0 1949
0 0 1627
0 0 1720
0 0 1231
0 0 1846
0 0 1216
0 0 1959
0 0 1561
0 0 1833
0 0 1814
0 0 688
0 0 525
0 0 1328
0 0 1917
0 ...

result:

ok good plan

Test #95:

score: 0
Accepted
time: 6ms
memory: 13936kb

input:

3998
101 2228 1187 585 883 567 359 1048 386 602 1161 824 1534 1906 788 2057 1081 736 1109 1676 1121 289 711 662 1377 350 1241 583 662 894 254 1561 2365 1873 823 1897 2112 797 1781 94 1398 43 418 1522 767 476 519 831 279 540 1383 912 1345 1734 737 1219 853 304 1486 1393 2126 448 836 564 878 152 1103 ...

output:

YES
2022086
101 422 1375
853 272 753
434 89 44
541 127 132
751 344 540
27 461 121
238 1278 129
919 812 140
246 1356 301
301 1391 218
943 298 734
90 195 1197
337 133 872
1034 37 618
170 328 707
1350 10 344
737 648 101
635 17 903
206 778 964
712 460 628
493 783 96
193 80 466
245 1418 29
633 108 1012
3...

result:

ok good plan

Test #96:

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

input:

3998
4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 ...

output:

YES
0
0 0 1165
0 0 1169
0 0 1795
0 0 429
0 0 1727
0 0 1870
0 0 1649
0 0 1900
0 0 1181
0 0 1177
0 0 1767
0 0 1951
0 0 1591
0 0 1732
0 0 1545
0 0 1012
0 0 1945
0 0 1601
0 0 1402
0 0 1340
0 0 1731
0 0 1070
0 0 850
0 0 1536
0 0 1900
0 0 1922
0 0 1222
0 0 824
0 0 1656
0 0 1580
0 0 1790
0 0 1817
0 0 1419
...

result:

ok good plan

Test #97:

score: 0
Accepted
time: 3ms
memory: 13804kb

input:

3993
65 1261 1802 1681 456 605 1380 532 1942 507 312 1404 361 1391 1235 556 1193 704 1776 780 777 1144 657 594 1389 1465 907 798 512 2121 1486 332 453 1376 877 1181 1745 647 54 960 1342 342 2276 1801 1268 1132 152 1670 1363 216 1027 662 527 1622 2488 566 927 612 1391 464 845 511 2203 325 587 967 680...

output:

NO

result:

ok IMPOSSIBLE

Test #98:

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

input:

3993
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

NO

result:

ok IMPOSSIBLE

Test #99:

score: 0
Accepted
time: 6ms
memory: 13984kb

input:

3998
120 521 1479 843 1075 789 1478 873 1016 296 751 875 859 1595 1344 428 1018 1534 1554 1065 706 708 1905 1218 897 1491 1274 2193 281 388 2120 1682 451 1629 741 162 1044 964 770 1635 1044 428 479 1117 1341 1674 596 993 1499 725 781 463 1612 498 686 1515 846 1700 534 921 859 1998 1018 343 728 1474 ...

output:

YES
1993830
120 1341 413
108 40 1389
90 698 294
549 534 0
1075 85 755
34 303 1176
302 532 704
169 413 67
949 189 135
161 956 636
115 240 280
595 93 148
711 231 999
596 171 684
660 226 207
221 933 451
567 487 634
900 34 637
917 863 36
1029 283 0
706 112 295
413 506 860
1045 578 360
858 137 627
270 11...

result:

ok good plan

Test #100:

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

input:

3998
4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 ...

output:

YES
0
0 0 1939
0 0 1892
0 0 1428
0 0 1485
0 0 1624
0 0 1462
0 0 828
0 0 1590
0 0 1731
0 0 1797
0 0 1421
0 0 1932
0 0 1548
0 0 1682
0 0 1283
0 0 1996
0 0 1944
0 0 952
0 0 1683
0 0 1898
0 0 1412
0 0 1471
0 0 1822
0 0 1425
0 0 1839
0 0 1088
0 0 1611
0 0 1311
0 0 1794
0 0 910
0 0 1859
0 0 881
0 0 1755
0...

result:

ok good plan

Test #101:

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

input:

3997
205 950 507 773 845 1161 1695 1077 689 1249 1975 2140 397 1664 917 628 1277 884 253 1606 243 2529 638 289 956 630 858 3220 1120 398 857 969 198 415 959 1167 1520 1290 803 427 652 1605 1459 899 823 1014 1909 1710 1495 137 2175 634 491 723 1714 329 639 1187 1003 391 791 1649 436 726 867 642 926 1...

output:

YES
1974690
205 133 733
217 597 381
126 1197 347
426 797 536
309 851 635
526 764 67
1628 17 82
995 92 585
104 509 1040
209 345 1217
758 116 1086
1054 481 377
20 963 876
788 148 512
405 295 17
611 42 228
1049 473 308
576 453 234
19 840 483
1123 353 232
11 2 1946
583 1350 66
572 671 58
231 1005 417
53...

result:

ok good plan

Test #102:

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

input:

3992
54 1451 345 1692 1220 936 190 1443 554 2186 863 2030 700 741 621 1303 351 1049 768 1098 918 1052 1346 242 2071 822 1094 1909 1322 918 839 1044 1401 1073 972 1194 697 1339 274 757 1261 1561 184 757 152 808 824 1230 977 837 1157 1692 1087 364 1090 1686 1644 361 1162 1043 1539 1647 611 744 520 219...

output:

YES
1981477
54 67 717
734 170 54
291 680 933
759 199 823
397 281 782
154 687 45
145 497 726
717 806 224
330 188 789
1397 102 360
503 397 1059
971 821 0
700 297 362
379 633 458
163 644 1118
185 122 175
176 1019 649
400 760 156
612 294 290
808 663 370
548 714 278
774 156 465
881 965 70
172 1098 688
13...

result:

ok good plan

Test #103:

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

input:

3992
4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 4000 ...

output:

YES
0
0 0 1611
0 0 931
0 0 643
0 0 900
0 0 1817
0 0 1639
0 0 1801
0 0 1813
0 0 532
0 0 1644
0 0 1448
0 0 771
0 0 1650
0 0 1669
0 0 1768
0 0 999
0 0 1602
0 0 1970
0 0 1967
0 0 1782
0 0 1505
0 0 1694
0 0 1896
0 0 1883
0 0 1590
0 0 1549
0 0 1757
0 0 1945
0 0 1792
0 0 1653
0 0 1804
0 0 1810
0 0 746
0 0 ...

result:

ok good plan

Subtask #4:

score: 9
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #104:

score: 9
Accepted
time: 0ms
memory: 13796kb

input:

2
273336192 360376735
865247429
231534513

output:

YES
231534502
273336192 231534502 360376735

result:

ok good plan

Test #105:

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

input:

2
521812203 64030418
893363128
366201574

output:

YES
307520507
521812203 307520507 64030418

result:

ok good plan

Test #106:

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

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:

YES
999998
999998 999998 0
999998 0 1
999997 0 2
999996 0 3
999995 0 4
999994 0 5
999993 0 6
999992 0 7
999991 0 8
999990 0 9
999989 0 10
999988 0 11
999987 0 12
999986 0 13
999985 0 14
999984 0 15
999983 0 16
999982 0 17
999981 0 18
999980 0 19
999979 0 20
999978 0 21
999977 0 22
999976 0 23
999975...

result:

ok good plan

Test #107:

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

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:

YES
999998
500000000 999998 499000002
999998 0 499000003
999997 0 499000004
999996 0 499000005
999995 0 499000006
999994 0 499000007
999993 0 499000008
999992 0 499000009
999991 0 499000010
999990 0 499000011
999989 0 499000012
999988 0 499000013
999987 0 499000014
999986 0 499000015
999985 0 499000...

result:

ok good plan

Test #108:

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

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:

YES
999998
999998 0 1
999997 0 2
999996 0 3
999995 0 4
999994 0 5
999993 0 6
999992 0 7
999991 0 8
999990 0 9
999989 0 10
999988 0 11
999987 0 12
999986 0 13
999985 0 14
999984 0 15
999983 0 16
999982 0 17
999981 0 18
999980 0 19
999979 0 20
999978 0 21
999977 0 22
999976 0 23
999975 0 24
999974 0 2...

result:

ok good plan

Test #109:

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

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:

YES
999998
500000000 0 1
499999999 0 2
499999998 0 3
499999997 0 4
499999996 0 5
499999995 0 6
499999994 0 7
499999993 0 8
499999992 0 9
499999991 0 10
499999990 0 11
499999989 0 12
499999988 0 13
499999987 0 14
499999986 0 15
499999985 0 16
499999984 0 17
499999983 0 18
499999982 0 19
499999981 0 2...

result:

ok good plan

Test #110:

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

input:

4000
103506654 1143414144 305897239 353369007 761879983 733507377 197067401 307600496 571846638 76537198 697117216 226161648 271990540 306087461 502629379 580078469 489211269 432705333 483871312 709445069 228591448 691638717 313833330 401558899 699561142 646573873 322793227 319733299 592401585 21904...

output:

YES
1000466633741
103506654 97877191 765508556
377905588 286741231 173453401
132443838 568725484 275178483
78190524 172398971 713717576
48162407 64183645 604241298
129266079 351051611 155155164
41912237 293050772 262314466
45286030 706011371 69271599
502575039 77447152 30519505
46017693 307938098 16...

result:

ok good plan

Test #111:

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

input:

4000
409141266 552023289 660020708 529554032 1022540135 535289264 146695196 203221601 181152519 360111363 642754980 743776281 620963697 208108848 192207144 579082420 109992768 218920044 410330140 879053729 186027362 519448454 928561793 633946125 355422583 596715546 201097413 287592006 272761844 4513...

output:

YES
900682666117
409141266 244858842 22336024
529687265 349029873 31621798
628398910 43026217 115880155
413673877 141646771 365807420
656732715 272403086 0
535289264 293143548 0
146695196 644099587 0
203221601 137302498 23328872
157823647 286943889 132635187
227476176 57708378 234081350
408673630 16...

result:

ok good plan

Test #112:

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

input:

1000000
336897992 519157910 698321893 589702374 480441770 139321861 694746378 642233894 931923392 478864073 334880895 947706532 576244463 545844980 565808033 1136791544 926544230 584680863 119190147 1061097041 424876936 535081554 242285267 819997693 473360649 742859702 822543930 130102771 826007471 ...

output:

YES
249710595855373
336897992 219805059 327530877
191627033 213434403 556003552
142318341 457688079 212341389
377360985 226055759 234581167
245860603 473002841 11648242
127673619 163492286 411491882
283254496 228724834 382756260
259477634 26705033 399377530
532545862 154315815 312148246
166715827 20...

result:

ok good plan

Test #113:

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

input:

1000000
90023483 490386192 312299781 310742934 444537751 150434626 489220067 156560617 523307561 293354557 571531266 624939907 350328982 252026750 914888871 784777010 350411175 592492227 854695068 642551098 877444021 131858130 424463263 176754567 633113191 690854679 134882079 523925142 844215433 642...

output:

YES
224939764515639
90023483 493867734 376384645
114001547 383314060 17613747
294686034 519263852 8648658
302094276 46634425 216360856
228176895 691429165 0
150434626 301972684 146906681
342313386 241239649 0
156560617 289761614 134733187
388574374 610107656 0
293354557 99962459 173154218
398377048 ...

result:

ok good plan

Test #114:

score: 0
Accepted
time: 185ms
memory: 27136kb

input:

1000000
0 5 8 6 5 7 11 2 2 8 14 10 5 7 7 10 3 6 8 8 3 10 10 8 12 3 14 2 7 7 9 4 9 5 3 12 0 5 3 9 3 7 3 6 2 7 5 8 1 1 6 9 4 7 1 8 1 7 3 5 5 7 6 4 5 3 5 4 6 10 2 8 6 11 2 8 3 4 13 5 0 5 12 8 7 3 5 9 3 5 7 8 3 3 11 7 11 5 11 3 7 4 4 6 7 9 5 4 7 5 3 6 6 6 9 5 4 6 5 10 7 6 3 4 5 7 1 6 8 3 4 6 7 10 5 4 7 ...

output:

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

result:

ok good plan

Test #115:

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

input:

1000000
14 99 33 50 93 71 59 48 49 43 67 68 84 58 29 76 81 57 64 8 28 31 139 20 28 126 26 18 34 49 49 37 22 45 23 41 43 81 55 23 63 60 30 69 96 22 93 40 38 30 87 35 37 34 131 57 51 34 117 78 72 23 140 32 62 39 20 66 23 36 89 87 25 16 25 57 70 47 43 86 38 45 71 29 21 31 33 63 25 15 76 54 44 78 97 21 ...

output:

YES
22757248
14 6 76
23 48 0
33 1 40
10 39 49
44 11 26
45 12 0
59 22 8
40 16 0
49 34 0
43 24 30
37 55 6
62 0 30
54 0 0
58 35 0
29 37 21
55 14 8
73 0 0
57 35 1
63 34 0
8 8 7
21 20 1
30 13 53
86 0 0
20 28 6
22 27 44
82 0 0
26 33 0
18 39 0
34 26 1
48 48 3
46 29 16
21 22 0
22 56 19
26 35 7
16 19 0
41 32...

result:

ok good plan

Test #116:

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

input:

1000000
1182410680 1813598916 1670137742 1255399251 1324468221 1652887459 1614429316 1273962035 1386251440 1333983586 1119953731 2000000000 1729048061 1575399624 1473109026 1659095310 1380238511 1464801414 1967832798 1504132330 1411462981 1382564027 1052004392 1876622232 1468930090 1298794206 161557...

output:

YES
0
0 0 546627091
0 0 856901460
0 0 805738385
0 0 908821923
0 0 775121335
0 0 772688152
0 0 620273579
0 0 866630095
0 0 849073557
0 0 446513077
0 0 799220220
0 0 988728717
0 0 843504684
0 0 889712197
0 0 566635968
0 0 987638664
0 0 704431412
0 0 888739155
0 0 615584017
0 0 642654244
0 0 790721097
...

result:

ok good plan

Test #117:

score: 0
Accepted
time: 44ms
memory: 20268kb

input:

1000000
0 0 0 0 0 0 0 0 0 0 0 113748194 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 23358385 0 0 0 0 0 0 0 0 0 200865354 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 57294045 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45379585 0 0 0 0 0 0 0 0 0 0 9...

output:

NO

result:

ok IMPOSSIBLE

Test #118:

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

input:

999998
437065169 764746968 413970889 483418865 273957586 592766873 740414841 217744647 896015141 1005915115 117509364 533221457 137364888 640141173 1146626056 138426464 346379155 108031417 742909901 739081068 298976023 398708756 671595664 349159654 439945829 360461626 571435108 1051377930 183167282 ...

output:

YES
250214666903653
437065169 136147920 251565910
513181058 173094773 245107839
168863050 449738131 347853564
135565301 731181498 10208272
263749314 74051584 591080228
1686645 810967273 149380036
591034805 242484865 120383059
97361588 65259519 684681567
211333574 257927542 420933767
584981348 496358...

result:

ok good plan

Test #119:

score: 0
Accepted
time: 389ms
memory: 27156kb

input:

999991
143740989 158455498 356311909 401297978 212750380 1055338089 317359878 588003073 491440815 679230506 527390645 496701685 239012984 115444806 794287829 550556548 348165976 464376817 719835655 461943625 542435632 831736541 333586000 476402313 628828050 499899252 380753843 789111106 921817647 25...

output:

YES
250066033768953
143740989 551881751 4936213
153519285 630172033 97834410
258477499 33809791 317041986
84255992 755457557 116275359
96475021 60201538 819695841
235642248 296563707 244225013
73134865 449208232 69802105
518200968 115250029 353748585
137692230 128732589 532649485
146581021 130335130...

result:

ok good plan

Test #120:

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

input:

999994
206030043 400947202 802805059 595763845 436923736 382379201 324527918 755900119 420981134 311797122 656016077 684287581 161145115 1114368916 395450977 471861671 519942750 570627691 949788932 517778129 862050355 494962042 781081516 104047400 221723815 750637187 520320587 547938768 201103507 19...

output:

YES
250260398380492
206030043 296014976 263758345
137188857 376937294 345547928
457257131 242899621 32706200
563057645 345420194 23925431
412998305 139306775 121492482
260886719 157954034 101049185
223478733 179679569 535110842
220789277 112455669 288990870
131990264 520618149 117024718
194772404 48...

result:

ok good plan

Test #121:

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

input:

999995
99433842 635282065 158814323 425624058 31044074 596983961 728391085 527753511 650134868 753012051 102609717 380029219 237405591 1016519643 837908973 577987695 270103124 930325600 454062840 99045437 181850575 184603653 614049415 619947399 198269886 313997019 996164754 157149689 564860453 28748...

output:

YES
249894495209907
99433842 67777451 290793805
344488260 27767196 113284180
45530143 255628709 407858755
17765303 180213047 27167825
3876249 223028980 511843014
85140947 102403217 433693024
294698061 195264210 365934011
161819500 406235784 309800200
340334668 398427220 132109299
620902752 17527632 ...

result:

ok good plan

Test #122:

score: 0
Accepted
time: 331ms
memory: 27156kb

input:

999991
115921662 599840787 183022173 890104761 46354161 714028205 513523095 307101868 855566851 184024388 1021025376 537744147 554958979 398166009 612639698 476758549 846560345 1180214394 645302978 709917790 458958446 158036747 498703197 43259048 970065163 297815123 172371703 17843510 705494546 7391...

output:

YES
249855528005296
115921662 153232541 343039420
256801367 120716371 26013785
157008388 349086406 7150807
882953954 102736500 8056996
38297165 73125998 374565054
339463151 264782848 144662065
368861030 92305763 232570217
74531651 293316784 600148322
255418529 130037916 5085696
178938692 14315100 71...

result:

ok good plan

Test #123:

score: 0
Accepted
time: 346ms
memory: 27128kb

input:

999993
483281857 834480433 188118381 1595428485 179504880 273845653 918047042 424249010 86139397 396794930 676770402 883715404 169662057 424706001 688578784 250573081 610681542 300986337 278292021 491582819 480582203 416259040 679243068 521329682 828423431 677798324 541688290 139963349 818562730 289...

output:

YES
249985721548251
483281857 149261268 293280224
541200209 14101721 42479273
145639108 10855526 842700103
752728382 76133819 100369136
79135744 286061026 80409645
193436008 94893826 524309060
393737982 135243873 312705766
111543244 363931705 42440716
43698681 566360912 389691469
7103461 524100449 2...

result:

ok good plan

Test #124:

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

input:

999992
29121863 226824046 169831576 267337177 121529602 374148603 516993918 421138907 437413640 361880948 887736110 177733542 664322762 261256711 1016376580 275177747 89354311 645662544 71491396 990529473 478149919 501418419 527205285 330509601 1115303094 538100956 544426812 127501499 1195745592 293...

output:

YES
249538497617401
29121863 221028193 205775078
21048968 70016247 52912098
116919478 249484074 53410
267283767 501420906 44943817
76585785 154805869 207422081
166726522 314797174 272420676
244573242 394577361 318061768
103077139 119932226 379231963
58181677 426910830 89667388
272213560 421265567 28...

result:

ok good plan

Test #125:

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

input:

999996
95271245 870513115 853269610 308452803 906447451 421688739 365085460 676125034 655280677 361113400 933186135 855481445 336043927 916883396 162698816 544973565 453120066 788536961 984858372 801692911 388280338 653141346 198944495 830477503 328483030 320230921 392726917 618889378 257269103 2704...

output:

YES
200445133569401
95271245 144027382 669275091
201238024 407360097 218397050
634872560 0 0
308452803 157735789 184794628
721652823 179865690 0
421688739 446880051 76003686
289081774 448499999 82563393
593561641 173166454 151323171
503957506 366478870 0
361113400 310592239 221697601
711488534 14457...

result:

ok good plan

Test #126:

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

input:

999996
103575724 549043254 626771047 710047633 557476011 613873375 346453101 375061421 601456263 765836719 576273324 400667018 364512488 542485149 520480023 1126095940 367603933 687479540 76917513 567409203 716124675 732611182 266620278 581511982 246537795 673642388 994996384 297230077 99507791 2526...

output:

YES
249862628294445
103575724 221977032 432287629
116755625 131229024 416380111
210390936 306975199 258403293
451644340 131878871 154988833
402487178 113069188 417157278
196716097 213372112 95868610
250584491 149784627 78482309
296579112 201100806 468752131
132704132 488834274 251840338
513996381 97...

result:

ok good plan

Test #127:

score: 0
Accepted
time: 364ms
memory: 27116kb

input:

999996
231877362 514260023 774013577 326929735 531851189 436725228 392154103 723672079 321625900 166967277 912507904 689445842 514428137 963663841 483964773 129185965 847522263 430383104 360015016 753745776 658078795 107902047 103792928 398476843 776532912 417946983 677996820 666841334 892974078 209...

output:

YES
245194079541257
231877362 319709107 385692081
128567942 12847775 724448302
49565275 321890402 117273136
209656599 68064184 205892727
325958462 447981609 214218086
222507142 662355176 0
392154103 174543277 267229309
456442770 499358332 0
321625900 519200093 0
166967277 175673831 473024023
4394838...

result:

ok good plan

Test #128:

score: 0
Accepted
time: 133ms
memory: 20572kb

input:

999994
91427504 703029432 330822130 1154093159 457856330 1006253810 462580275 366862772 424934961 437055074 178912002 414254329 305426657 1424163668 412207346 494071028 377761923 33082420 653559363 442385818 585435141 1056616700 512266090 842493899 610956363 483638604 742747043 604704638 255963492 1...

output:

NO

result:

ok IMPOSSIBLE

Test #129:

score: 0
Accepted
time: 122ms
memory: 20784kb

input:

999994
5568574 436144569 580424645 649813804 563733677 90655357 591134628 667058423 740550292 771634585 836422896 293265059 37678445 60903247 429868535 792866952 849695975 606867663 323553545 136297939 102709072 635852246 805682215 435230234 695361391 598139835 380610847 455077654 507094567 34030003...

output:

NO

result:

ok IMPOSSIBLE

Test #130:

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

input:

999991
360372385 365744478 559493006 242872844 846437206 492902878 371930786 586120976 421524375 350167638 280701075 1026962446 446535043 655401556 251256538 349502593 1317341247 381440587 635404902 491770623 929900395 280241964 181391080 251490707 1265699887 536404826 710274681 241139406 488894352 ...

output:

YES
249812623575973
360372385 248061653 249984247
115760231 79605821 275600950
283892056 590212613 105733041
137139803 91877981 395797638
450639568 116703848 302832560
190070318 651010033 59198102
312732684 143277602 200550923
385570053 314944360 243328193
178196182 83491029 233263146
116904492 2378...

result:

ok good plan

Test #131:

score: 0
Accepted
time: 80ms
memory: 21460kb

input:

999991
29647258 407002122 912126450 156025842 906016278 363386088 353529370 169493327 1127544876 343793807 834575848 277571004 566981974 623817808 179893748 697878696 176320722 1196733495 749222093 241913112 902537115 181967398 479807104 661266939 856218954 610515522 938877391 412223839 424675730 28...

output:

NO

result:

ok IMPOSSIBLE

Test #132:

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

input:

999995
365212131 471289037 648245843 213129555 529946786 416922444 74585667 341653527 1373735200 205858667 861990491 318836113 876348713 512267642 85757678 197191276 224960817 339977471 255030195 91399684 608326280 578663360 547289283 209770575 505072558 365174844 506359576 377208114 479984766 38756...

output:

YES
249446043133001
365212131 327043898 151673952
319615085 251551412 218705101
429540742 271446059 85606159
127523396 147967105 217823764
312123022 21026359 406983309
9939135 17927551 22990218
51595449 568054170 263276448
78377079 164504848 748489911
625245289 22916844 36805443
169053224 242348604 ...

result:

ok good plan

Test #133:

score: 0
Accepted
time: 356ms
memory: 27156kb

input:

999992
450888482 199546545 346691003 257295554 170873704 212003023 206881887 591104844 242655983 421776158 1131233051 244620697 567771530 578533920 624957656 117850565 167893969 696415970 206477039 314922875 256545276 748386405 664520056 365516067 673513354 550099033 531707579 886115521 565613386 35...

output:

YES
249952181659788
450888482 368905553 66902010
132644535 561901404 254694971
91996032 174981973 25967619
231327935 419989486 108095681
62778023 700625425 211092788
910235 279230778 171082959
35798928 78003545 543058897
48045947 541849353 213574046
29081937 81049930 350942341
70833817 4036852 69206...

result:

ok good plan

Test #134:

score: 0
Accepted
time: 359ms
memory: 26992kb

input:

999992
147744110 839012150 312157070 556385304 458470361 855344550 216633034 895798392 80909209 429810529 264272737 308856629 140604864 169111730 561895591 245183032 638724011 284456278 508473214 501911525 525697204 343653053 369176372 516230223 833371671 50198183 1122047455 689566722 618093669 3034...

output:

YES
239922644085825
147744110 88239207 152056270
686955880 82922287 83365186
228791884 655989786 52934187
503451117 129548101 146333195
312137166 254527428 250919335
604425215 236242216 0
216633034 255402721 488122971
407675421 285014608 0
80909209 343527615 168671565
261138964 223659242 105816370
1...

result:

ok good plan

Test #135:

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

input:

999996
133457192 390904600 665679455 718765562 410021244 676389483 246271595 124884718 681519368 238427806 396289487 467077848 447218067 894843953 487981785 537196068 1140115015 225939273 647265629 763539567 970326451 175784540 699781461 1093234672 341870107 162012179 382692156 242353795 243105450 8...

output:

YES
249990170588792
133457192 485740304 272715010
118189590 232810253 623195969
42483486 127303535 465555296
253210266 57501548 101010946
309010298 304074733 233105713
443283770 295756910 106651844
139619751 459299441 107237035
17647683 115473053 380195267
301324101 141573914 132500522
105927284 626...

result:

ok good plan

Test #136:

score: 0
Accepted
time: 134ms
memory: 21400kb

input:

999996
199884537 611946609 391605741 367200560 395135748 395168197 486283011 335431872 549781589 602199810 917091262 50213556 610922934 287011475 328788309 1220271060 320793507 894937658 654452823 263842013 417277123 1147451581 876101265 520564137 877621036 228335814 536024534 379235898 784645461 67...

output:

NO

result:

ok IMPOSSIBLE

Test #137:

score: 0
Accepted
time: 214ms
memory: 20608kb

input:

999997
444958663 237529290 401150348 846306354 90068035 404755618 320674600 357426542 109945299 494562819 321026559 239482855 108656527 602592892 577495184 874574340 881835501 397506860 398246720 187633997 586894262 759751507 500304096 190673170 1084450468 24034046 293235792 343585276 581262058 5067...

output:

NO

result:

ok IMPOSSIBLE

Test #138:

score: 0
Accepted
time: 160ms
memory: 20320kb

input:

999997
518363351 510503347 834875166 344124787 352647052 221809921 793246820 227397674 679564792 169170706 459570819 124245023 600432166 515923113 1101890699 1126211580 36170625 655958726 674098331 622154466 154331928 497568353 408989648 101596084 530093461 265850422 1215920958 200926430 774254479 1...

output:

NO

result:

ok IMPOSSIBLE

Extra Test:

score: 0
Extra Test Passed