QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#645405#7157. Bikes vs Carsyanshanjiahong34 188ms23788kbC++142.5kb2024-10-16 18:10:542024-10-16 18:10:54

Judging History

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

  • [2024-10-16 18:10:54]
  • 评测
  • 测评结果:34
  • 用时:188ms
  • 内存:23788kb
  • [2024-10-16 18:10:54]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i,j,k) for(int i=j;i<=k;i++)
#define repp(i,j,k) for(int i=j;i>=k;i--)
#define ls(x) (x<<1)
#define rs(x) ((x<<1)|1)
#define mp make_pair
#define sec second
#define fir first
#define pii pair<int,int>
#define lowbit(i) i&-i
#define int long long
#define double long double
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=505,M=5e5+5,S=(1<<15)+5,inf=(ll)1e18+7,mo=1e9+7;
const double eps=1e-8;
void read(int &p){
	int x=0,w=1;
	char ch=0;
	while(!isdigit(ch)){
		if(ch=='-')w=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+ch-'0';
		ch=getchar();
	}
	p=x*w;
}
int n,w,b[N][N],c[N][N],cntb,cntc;
struct edge{
    int x,y,v;
    friend bool operator<(edge x,edge y){
        return x.v>y.v;
    }
}eb[N*N],ec[N*N];
vector<edge>ans;
int valb[N][N],valc[N][N];
struct bcj{
    int fa[N];
    void init(){
        rep(i,1,n)
            fa[i]=i;
    }
    int find(int x){
        if(fa[x]==x)return x;
        return fa[x]=find(fa[x]);
    }
    bool merge(int x,int y){
        x=find(x),y=find(y);
        if(x==y)return 0;
        fa[x]=y;
        return 1;
    }
}B;
signed main(){
    read(n),read(w);
    rep(j,2,n){
        rep(i,1,j-1)
            read(c[i][j]),ec[++cntc]=(edge){i,j,c[i][j]};
    }
    rep(j,2,n){
        rep(i,1,j-1)
            read(b[i][j]),eb[++cntb]=(edge){i,j,b[i][j]};
    }
    sort(eb+1,eb+cntb+1),sort(ec+1,ec+cntc+1);
    rep(i,1,n){
        rep(j,1,n)
            valb[i][j]=valc[i][j]=0;
    }
    B.init();
    rep(i,1,cntb){
        int x=eb[i].x,y=eb[i].y,v=eb[i].v;
        if(c[x][y]+v<w)continue;
        if(B.merge(x,y))ans.push_back((edge){x,y,v}),valb[x][y]=valb[y][x]=v;
    }
    B.init();
    rep(i,1,cntc){
        int x=ec[i].x,y=ec[i].y,v=ec[i].v;
        if(b[x][y]+v<w)continue;
        if(B.merge(x,y))ans.push_back((edge){x,y,w-v}),valc[x][y]=valc[y][x]=v;
    }
    rep(k,1,n){
        rep(i,1,n){
            rep(j,1,n){
                valb[i][j]=max(valb[i][j],min(valb[i][k],valb[k][j]));
                valc[i][j]=max(valc[i][j],min(valc[i][k],valc[k][j]));
            }
        }
    }
    bool ok=1;
    rep(i,1,n){
        rep(j,i+1,n)
            if(valb[i][j]!=b[i][j]||valc[i][j]!=c[i][j])ok=0;
    }
    if(!ok)puts("NO");
    else{
        printf("%lld\n",ans.size());
        for(auto j:ans)
            printf("%lld %lld %lld\n",j.x-1,j.y-1,j.v);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 2ms
memory: 14152kb

input:

14 1000000
494185
494185 494185
494185 494185 494185
494185 494185 494185 494185
494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 49...

output:

26
1 11 536641
1 12 536641
0 12 536641
10 11 536641
9 11 536641
8 11 536641
7 11 536641
6 11 536641
5 11 536641
4 11 536641
3 11 536641
2 11 536641
1 13 536641
1 11 505815
1 12 505815
0 12 505815
10 11 505815
9 11 505815
8 11 505815
7 11 505815
6 11 505815
5 11 505815
4 11 505815
3 11 505815
2 11 50...

result:

ok 

Test #2:

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

input:

37 1000000
891050
891050 891050
891050 891050 891050
891050 891050 891050 891050
891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 89...

output:

NO

result:

ok 

Test #3:

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

input:

40 1000000
824509
824509 824509
824509 824509 824509
824509 824509 824509 824509
824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 82...

output:

78
28 32 175491
16 32 175491
17 32 175491
18 32 175491
19 32 175491
20 32 175491
21 32 175491
22 32 175491
23 32 175491
24 32 175491
25 32 175491
26 32 175491
27 32 175491
15 32 175491
29 32 175491
30 32 175491
31 32 175491
0 33 175491
1 33 175491
2 33 175491
3 33 175491
4 33 175491
5 33 175491
6 33...

result:

ok 

Test #4:

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

input:

40 1000000
209146
209146 209146
209146 209146 209146
209146 209146 209146 209146
209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 20...

output:

78
28 32 806691
16 32 806691
17 32 806691
18 32 806691
19 32 806691
20 32 806691
21 32 806691
22 32 806691
23 32 806691
24 32 806691
25 32 806691
26 32 806691
27 32 806691
15 32 806691
29 32 806691
30 32 806691
31 32 806691
0 33 806691
1 33 806691
2 33 806691
3 33 806691
4 33 806691
5 33 806691
6 33...

result:

ok 

Test #5:

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

input:

40 1000000
750045
750045 750045
750045 750045 750045
750045 750045 750045 750045
750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 75...

output:

NO

result:

ok 

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #6:

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

input:

14 1000000
494185
494185 494185
494185 494185 494185
494185 494185 494185 494185
494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 49...

output:

26
1 11 536641
1 12 536641
0 12 536641
10 11 536641
9 11 536641
8 11 536641
7 11 536641
6 11 536641
5 11 536641
4 11 536641
3 11 536641
2 11 536641
1 13 536641
1 11 505815
1 12 505815
0 12 505815
10 11 505815
9 11 505815
8 11 505815
7 11 505815
6 11 505815
5 11 505815
4 11 505815
3 11 505815
2 11 50...

result:

ok 

Test #7:

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

input:

37 1000000
891050
891050 891050
891050 891050 891050
891050 891050 891050 891050
891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 89...

output:

NO

result:

ok 

Test #8:

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

input:

40 1000000
824509
824509 824509
824509 824509 824509
824509 824509 824509 824509
824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 82...

output:

78
28 32 175491
16 32 175491
17 32 175491
18 32 175491
19 32 175491
20 32 175491
21 32 175491
22 32 175491
23 32 175491
24 32 175491
25 32 175491
26 32 175491
27 32 175491
15 32 175491
29 32 175491
30 32 175491
31 32 175491
0 33 175491
1 33 175491
2 33 175491
3 33 175491
4 33 175491
5 33 175491
6 33...

result:

ok 

Test #9:

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

input:

40 1000000
209146
209146 209146
209146 209146 209146
209146 209146 209146 209146
209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 20...

output:

78
28 32 806691
16 32 806691
17 32 806691
18 32 806691
19 32 806691
20 32 806691
21 32 806691
22 32 806691
23 32 806691
24 32 806691
25 32 806691
26 32 806691
27 32 806691
15 32 806691
29 32 806691
30 32 806691
31 32 806691
0 33 806691
1 33 806691
2 33 806691
3 33 806691
4 33 806691
5 33 806691
6 33...

result:

ok 

Test #10:

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

input:

40 1000000
750045
750045 750045
750045 750045 750045
750045 750045 750045 750045
750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 75...

output:

NO

result:

ok 

Test #11:

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

input:

74 1000000
883981
883981 883981
883981 883981 883981
883981 883981 883981 883981
883981 883981 883981 883981 883981
883981 883981 883981 883981 883981 883981
883981 883981 883981 883981 883981 883981 883981
883981 883981 883981 883981 883981 883981 883981 883981
883981 883981 883981 883981 883981 88...

output:

146
34 60 259437
24 60 259437
25 60 259437
26 60 259437
27 60 259437
28 60 259437
29 60 259437
30 60 259437
31 60 259437
32 60 259437
33 60 259437
23 60 259437
35 60 259437
36 60 259437
37 60 259437
38 60 259437
39 60 259437
40 60 259437
41 60 259437
42 60 259437
43 60 259437
44 60 259437
13 60 2594...

result:

ok 

Test #12:

score: 5
Accepted
time: 39ms
memory: 16760kb

input:

293 1000000
699926
699926 699926
699926 699926 699926
699926 699926 699926 699926
699926 699926 699926 699926 699926
699926 699926 699926 699926 699926 699926
699926 699926 699926 699926 699926 699926 699926
699926 699926 699926 699926 699926 699926 699926 699926
699926 699926 699926 699926 699926 6...

output:

NO

result:

ok 

Test #13:

score: 5
Accepted
time: 87ms
memory: 19240kb

input:

387 1000000
771151
771151 771151
771151 771151 771151
771151 771151 771151 771151
771151 771151 771151 771151 771151
771151 771151 771151 771151 771151 771151
771151 771151 771151 771151 771151 771151 771151
771151 771151 771151 771151 771151 771151 771151 771151
771151 771151 771151 771151 771151 7...

output:

772
20 316 228849
29 316 228849
28 316 228849
27 316 228849
26 316 228849
25 316 228849
24 316 228849
23 316 228849
22 316 228849
21 316 228849
30 316 228849
19 316 228849
18 316 228849
17 316 228849
16 316 228849
15 316 228849
14 316 228849
13 316 228849
12 316 228849
39 316 228849
47 316 228849
46...

result:

ok 

Test #14:

score: 5
Accepted
time: 176ms
memory: 19680kb

input:

498 1000000
419303
419303 419303
419303 419303 419303
419303 419303 419303 419303
419303 419303 419303 419303 419303
419303 419303 419303 419303 419303 419303
419303 419303 419303 419303 419303 419303 419303
419303 419303 419303 419303 419303 419303 419303 419303
419303 419303 419303 419303 419303 4...

output:

994
281 406 941592
296 406 941592
295 406 941592
294 406 941592
293 406 941592
292 406 941592
291 406 941592
290 406 941592
289 406 941592
288 406 941592
287 406 941592
286 406 941592
285 406 941592
284 406 941592
283 406 941592
282 406 941592
297 406 941592
280 406 941592
279 406 941592
278 406 941...

result:

ok 

Test #15:

score: 5
Accepted
time: 177ms
memory: 19528kb

input:

500 1000000
399243
399243 399243
399243 399243 399243
399243 399243 399243 399243
399243 399243 399243 399243 399243
399243 399243 399243 399243 399243 399243
399243 399243 399243 399243 399243 399243 399243
399243 399243 399243 399243 399243 399243 399243 399243
399243 399243 399243 399243 399243 3...

output:

NO

result:

ok 

Subtask #3:

score: 0
Wrong Answer

Test #16:

score: 17
Accepted
time: 0ms
memory: 14132kb

input:

14 1000000
494185
494185 494185
494185 494185 494185
494185 494185 494185 494185
494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 49...

output:

26
1 11 536641
1 12 536641
0 12 536641
10 11 536641
9 11 536641
8 11 536641
7 11 536641
6 11 536641
5 11 536641
4 11 536641
3 11 536641
2 11 536641
1 13 536641
1 11 505815
1 12 505815
0 12 505815
10 11 505815
9 11 505815
8 11 505815
7 11 505815
6 11 505815
5 11 505815
4 11 505815
3 11 505815
2 11 50...

result:

ok 

Test #17:

score: 17
Accepted
time: 0ms
memory: 14036kb

input:

37 1000000
891050
891050 891050
891050 891050 891050
891050 891050 891050 891050
891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 89...

output:

NO

result:

ok 

Test #18:

score: 17
Accepted
time: 0ms
memory: 14176kb

input:

40 1000000
824509
824509 824509
824509 824509 824509
824509 824509 824509 824509
824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 82...

output:

78
28 32 175491
16 32 175491
17 32 175491
18 32 175491
19 32 175491
20 32 175491
21 32 175491
22 32 175491
23 32 175491
24 32 175491
25 32 175491
26 32 175491
27 32 175491
15 32 175491
29 32 175491
30 32 175491
31 32 175491
0 33 175491
1 33 175491
2 33 175491
3 33 175491
4 33 175491
5 33 175491
6 33...

result:

ok 

Test #19:

score: 17
Accepted
time: 0ms
memory: 14264kb

input:

40 1000000
209146
209146 209146
209146 209146 209146
209146 209146 209146 209146
209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 20...

output:

78
28 32 806691
16 32 806691
17 32 806691
18 32 806691
19 32 806691
20 32 806691
21 32 806691
22 32 806691
23 32 806691
24 32 806691
25 32 806691
26 32 806691
27 32 806691
15 32 806691
29 32 806691
30 32 806691
31 32 806691
0 33 806691
1 33 806691
2 33 806691
3 33 806691
4 33 806691
5 33 806691
6 33...

result:

ok 

Test #20:

score: 17
Accepted
time: 0ms
memory: 11932kb

input:

40 1000000
750045
750045 750045
750045 750045 750045
750045 750045 750045 750045
750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 75...

output:

NO

result:

ok 

Test #21:

score: 17
Accepted
time: 2ms
memory: 14128kb

input:

29 1000000
552337
552337 552337
552337 552337 552337
552337 552337 552337 552337
552337 552337 552337 552337 552351
552337 552337 552337 552337 552337 552337
552337 552337 552337 552337 552337 552337 552337
552337 552337 552337 552337 552337 552337 552337 552337
552337 552337 552495 552337 552337 55...

output:

56
12 24 686891
4 7 625206
16 28 505246
2 5 477837
9 14 455169
10 26 453391
1 7 448166
12 13 447819
8 21 447706
3 27 447673
20 25 447670
13 17 447669
0 22 447669
2 26 447664
0 24 447663
7 24 447663
18 23 447663
22 23 447663
19 23 447663
20 23 447663
21 23 447663
16 23 447663
15 23 447663
14 23 44766...

result:

ok 

Test #22:

score: 17
Accepted
time: 0ms
memory: 14100kb

input:

38 1000000
644854
305125 329501
622065 236824 258517
48699 83625 610390 428345
701467 277887 953203 525250 385114
76769 66822 672789 788732 775160 808418
853646 260433 492908 977883 617979 867959 421170
502969 424166 347568 6763 982035 787624 793664 504750
538453 215494 17775 859568 661147 434750 87...

output:

NO

result:

ok 

Test #23:

score: 17
Accepted
time: 2ms
memory: 12228kb

input:

39 1000000
439480
439480 439480
439480 439480 439480
439480 439480 439480 439480
439480 439480 439480 439480 439480
439480 439480 439480 439480 439480 439480
439480 439480 439480 439480 439480 439480 439480
439480 439480 439480 439480 439480 439480 439480 439480
439480 439480 439480 439480 439480 43...

output:

76
22 37 572459
34 35 560629
0 20 560615
9 15 560599
12 23 560578
16 25 560533
10 13 560524
26 35 560523
28 32 560522
11 19 560522
8 32 560520
10 32 560520
25 31 560520
26 31 560520
27 31 560520
28 31 560520
3 31 560520
29 31 560520
9 32 560520
30 31 560520
7 32 560520
0 32 560520
1 32 560520
2 32 5...

result:

ok 

Test #24:

score: 17
Accepted
time: 3ms
memory: 13992kb

input:

40 1000000
812846
911882 401702
839635 826274 227560
340209 296171 94861 560840
571964 575838 494308 103484 665078
226603 679169 882216 594847 682669 947984
977195 661728 636783 21343 492814 536880 352704
6236 35639 429632 687960 183983 979198 548633 605360
26055 21697 783001 507340 363601 684140 30...

output:

NO

result:

ok 

Test #25:

score: 17
Accepted
time: 0ms
memory: 14260kb

input:

40 1000000
389519
312963 312963
312963 312963 312963
312963 312963 312963 312963
312963 312963 312963 312963 312963
312963 312963 312963 312963 312963 312963
312963 312963 312963 312963 312963 312963 312963
312963 312963 312963 312963 312963 312963 312963 312963
312963 312963 312963 312963 312963 31...

output:

78
15 36 869851
19 24 747228
11 28 724323
21 30 712978
10 25 699494
13 22 696652
0 20 688096
7 35 687801
12 17 687383
13 39 687124
3 18 687052
6 22 687043
27 35 687041
4 38 687041
16 29 687039
2 31 687039
5 15 687039
14 36 687039
2 23 687039
31 32 687037
9 33 687037
8 32 687037
28 32 687037
7 32 687...

result:

ok 

Test #26:

score: 17
Accepted
time: 3ms
memory: 14180kb

input:

40 3
2
1 1
1 1 2
1 1 1 1
1 1 1 1 2
1 1 1 1 1 1
1 1 1 1 1 1 2
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1...

output:

78
7 8 2
37 38 2
35 36 2
31 32 2
5 6 2
29 30 2
25 26 2
17 18 2
9 10 2
33 34 2
11 12 2
27 28 2
3 4 2
13 14 2
19 20 2
21 22 2
23 24 2
15 16 2
1 2 2
30 31 1
32 33 1
28 29 1
36 37 1
38 39 1
34 35 1
16 17 1
14 15 1
18 19 1
6 7 1
8 9 1
4 5 1
2 3 1
12 13 1
10 11 1
24 25 1
26 27 1
0 1 1
20 21 1
22 23 1
34 3...

result:

ok 

Test #27:

score: 17
Accepted
time: 0ms
memory: 14152kb

input:

6 3
2
1 1
1 1 2
1 1 1 1
1 1 1 1 2
1
1 2
1 1 1
1 1 1 2
1 1 1 1 1

output:

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

result:

ok 

Test #28:

score: 17
Accepted
time: 0ms
memory: 12240kb

input:

40 1000000
670370
677873 670370
958935 670370 677873
670370 708712 670370 670370
769094 670370 677873 769094 670370
769094 670370 677873 769094 670370 983647
670370 855332 670370 670370 708712 670370 670370
662193 662193 662193 662193 662193 662193 662193 662193
670370 801983 670370 670370 708712 67...

output:

78
3 4 999224
5 34 978668
3 8 976327
28 38 974253
13 16 972484
9 39 968618
16 26 956000
31 36 953820
6 35 934621
20 27 922895
16 28 919833
30 31 906210
5 10 896680
3 22 893578
4 38 857313
3 11 857209
15 37 852420
23 32 851102
11 17 846629
22 25 840140
18 26 835365
17 24 833292
35 39 824933
0 21 8139...

result:

ok 

Test #29:

score: 17
Accepted
time: 2ms
memory: 12216kb

input:

40 2
2
2 2
1 1 1
2 2 2 1
2 2 2 1 2
2 2 2 1 2 2
2 2 2 1 2 2 2
2 2 2 1 2 2 2 2
1 1 1 1 1 1 1 1 1
1 1 1 2 1 1 1 1 1 1
1 1 1 2 1 1 1 1 1 1 2
1 1 1 2 1 1 1 1 1 1 2 2
2 2 2 1 2 2 2 2 2 1 1 1 1
2 2 2 1 2 2 2 2 2 1 1 1 1 2
1 1 1 2 1 1 1 1 1 1 2 2 2 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 1 2 2 2 2 2 1 1 1...

output:

78
24 31 2
12 31 2
14 31 2
15 31 2
16 31 2
17 31 2
19 31 2
20 31 2
21 31 2
22 31 2
23 31 2
11 31 2
26 31 2
27 31 2
29 31 2
30 31 2
0 32 2
1 32 2
2 32 2
3 32 2
4 32 2
0 31 2
6 32 2
7 31 2
8 31 2
9 31 2
10 31 2
10 33 2
16 38 2
29 36 2
34 36 2
35 36 2
27 39 2
3 28 1
5 11 1
2 37 1
25 27 1
13 31 1
18 27 ...

result:

ok 

Test #30:

score: 0
Wrong Answer
time: 0ms
memory: 14264kb

input:

40 1000000
893814
0 0
808488 808488 0
0 0 377106 0
0 0 377106 0 607352
735217 735217 0 735217 0 0
808488 808488 0 860179 0 0 735217
952655 893814 0 808488 0 0 735217 808488
0 0 377106 0 607352 799018 0 0 0
0 0 377106 0 818950 607352 0 0 0 607352
0 0 377106 0 607352 860514 0 0 0 799018 607352
0 0 377...

output:

76
25 30 999902
8 29 975889
3 19 964902
8 34 956791
14 35 952662
0 24 945364
6 24 941905
3 28 933634
8 28 914817
11 26 912323
18 29 909302
0 1 888305
14 29 886805
24 25 874375
21 26 860925
23 38 858533
36 37 855086
24 31 825550
33 35 808606
20 23 806427
2 20 789606
29 30 774747
10 16 771422
28 39 76...

result:

wrong answer The graph is not connected

Subtask #4:

score: 0
Wrong Answer

Test #39:

score: 18
Accepted
time: 6ms
memory: 17104kb

input:

163 1
0
0 0
0 1 0
1 0 0 0
0 0 0 0 0
1 0 0 0 1 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 1
0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 1
0 1 0 1 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 1 1 0 0 0
0 0 0 0 0 1 0 0 0 0 0 1 1 0 0
0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1 1 0 0 ...

output:

324
31 60 1
55 109 1
20 60 1
69 153 1
51 109 1
25 60 1
66 153 1
50 109 1
49 109 1
63 82 1
67 82 1
61 82 1
60 153 1
34 60 1
45 109 1
87 98 1
57 153 1
39 60 1
55 153 1
117 128 1
114 135 1
52 59 1
79 82 1
116 135 1
90 153 1
58 59 1
0 60 1
79 144 1
87 153 1
118 128 1
78 98 1
81 153 1
107 128 1
17 61 1
1...

result:

ok 

Test #40:

score: 18
Accepted
time: 90ms
memory: 19048kb

input:

387 1
0
0 0
0 0 0
1 1 1 0
1 0 0 1 0
1 1 0 0 1 1
1 1 1 1 0 0 0
1 0 0 0 0 1 1 0
1 1 0 0 1 1 0 0 0
1 0 1 0 1 1 1 1 1 0
1 0 0 0 0 0 1 1 1 1 0
0 0 0 1 1 0 1 0 1 1 0 1
0 1 0 1 1 0 1 1 0 0 1 0 0
1 1 1 1 1 0 1 0 0 1 1 1 0 1
0 0 0 0 0 1 1 1 0 1 1 1 0 0 1
1 1 0 0 0 1 1 1 1 1 1 0 0 1 0 0
1 1 0 0 0 1 0 1 1 1 0 ...

output:

NO

result:

ok 

Test #41:

score: 18
Accepted
time: 155ms
memory: 21796kb

input:

482 1
0
0 0
0 0 0
0 0 0 0
0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 0 0 ...

output:

962
221 423 1
240 423 1
267 282 1
268 282 1
269 282 1
238 423 1
237 423 1
233 423 1
277 282 1
278 282 1
280 282 1
224 423 1
6 283 1
264 282 1
10 283 1
11 283 1
220 423 1
13 283 1
14 283 1
16 283 1
17 283 1
217 423 1
215 423 1
214 423 1
23 283 1
262 423 1
211 282 1
213 282 1
218 282 1
227 282 1
228 2...

result:

ok 

Test #42:

score: 18
Accepted
time: 154ms
memory: 21520kb

input:

475 1
0
1 1
0 0 0
0 0 1 0
0 1 0 0 0
0 0 1 1 0 1
1 0 0 0 1 1 0
0 0 1 0 0 1 1 0
1 1 1 1 0 1 1 0 1
0 0 0 1 0 0 0 1 0 1
1 0 1 1 0 1 1 1 1 0 0
1 0 0 0 1 1 1 0 1 0 1 0
0 0 0 0 1 1 1 0 1 1 1 1 0
0 1 1 1 0 1 0 1 1 1 0 0 0 1
0 1 0 1 1 0 1 0 1 1 1 0 1 1 0
0 0 0 0 0 1 0 0 1 1 1 1 0 0 1 0
1 0 1 0 1 1 0 1 0 0 1 ...

output:

NO

result:

ok 

Test #43:

score: 18
Accepted
time: 172ms
memory: 23720kb

input:

500 1
0
0 0
0 0 0
0 0 0 0
0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 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:

998
322 342 1
80 212 1
313 342 1
77 212 1
76 212 1
75 212 1
74 212 1
314 342 1
72 212 1
239 277 1
316 342 1
70 402 1
134 315 1
48 465 1
132 315 1
50 465 1
311 342 1
66 402 1
324 342 1
58 212 1
245 277 1
63 402 1
246 277 1
329 342 1
59 465 1
248 277 1
129 315 1
65 465 1
340 418 1
67 465 1
68 465 1
69...

result:

ok 

Test #44:

score: 18
Accepted
time: 169ms
memory: 19392kb

input:

500 1
0
0 0
0 0 1
1 1 0 0
1 1 1 1 0
0 0 0 0 1 1
0 1 0 1 1 0 1
1 1 1 1 1 1 1 1
0 1 0 0 1 0 1 0 1
0 1 0 1 0 0 0 0 0 0
1 0 1 0 0 0 0 0 0 1 1
0 0 1 0 0 0 0 1 0 1 0 1
0 1 1 0 1 0 0 0 0 0 1 1 0
1 1 0 1 0 1 0 1 0 1 1 1 0 1
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
1 1 1 0 1 1 1 0 0 1 0 0 0 0 0 1
0 0 0 0 1 0 1 0 0 0 0 ...

output:

NO

result:

ok 

Test #45:

score: 18
Accepted
time: 176ms
memory: 19712kb

input:

500 1
0
0 0
0 0 0
0 0 0 1
0 0 0 1 1
0 0 0 0 0 0
1 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 ...

output:

998
72 145 1
44 67 1
117 405 1
75 163 1
183 301 1
224 349 1
139 173 1
68 111 1
107 225 1
146 296 1
385 416 1
133 173 1
57 67 1
202 371 1
8 479 1
29 411 1
128 279 1
105 385 1
270 312 1
80 145 1
124 279 1
318 343 1
69 375 1
216 491 1
147 473 1
96 462 1
193 408 1
128 326 1
351 447 1
341 444 1
182 334 1...

result:

ok 

Test #46:

score: 18
Accepted
time: 172ms
memory: 23788kb

input:

500 1
1
0 0
0 0 1
0 0 0 0
0 0 0 0 1
0 0 0 0 0 0
0 0 0 0 0 0 1
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 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:

998
211 212 1
49 50 1
293 294 1
69 70 1
279 280 1
343 344 1
189 190 1
243 244 1
387 388 1
213 214 1
205 206 1
177 178 1
135 136 1
109 110 1
163 164 1
245 246 1
417 418 1
19 20 1
373 374 1
275 276 1
459 460 1
283 284 1
29 30 1
345 346 1
405 406 1
111 112 1
113 114 1
21 22 1
93 94 1
383 384 1
331 332 ...

result:

ok 

Test #47:

score: 18
Accepted
time: 0ms
memory: 14032kb

input:

6 1
1
0 0
0 0 0
0 0 0 0
0 0 0 0 1
0
0 1
0 0 0
0 0 0 1
1 0 0 0 0

output:

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

result:

ok 

Test #48:

score: 0
Wrong Answer
time: 176ms
memory: 19636kb

input:

500 1
0
0 1
0 1 1
0 1 1 1
0 1 1 1 1
0 1 1 1 1 1
0 0 0 0 0 0 0
1 0 0 0 0 0 0 0
0 1 1 1 1 1 1 0 0
1 0 0 0 0 0 0 0 1 0
1 0 0 0 0 0 0 0 1 0 1
1 0 0 0 0 0 0 0 1 0 1 1
1 0 0 0 0 0 0 0 1 0 1 1 1
1 0 0 0 0 0 0 0 1 0 1 1 1 1
1 0 0 0 0 0 0 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 0 0 1 0 0 0 0 0 0
0 1 1 1 1 1 1 0 0 1 0 ...

output:

996
140 282 1
104 453 1
58 369 1
128 282 1
57 369 1
130 282 1
56 369 1
132 282 1
133 282 1
134 282 1
135 282 1
136 282 1
100 453 1
207 417 1
139 282 1
105 453 1
142 282 1
143 282 1
144 282 1
97 453 1
96 453 1
147 282 1
148 282 1
53 369 1
94 453 1
209 417 1
51 369 1
153 282 1
49 369 1
115 453 1
95 28...

result:

wrong answer The graph is not connected

Subtask #5:

score: 19
Accepted

Dependency #2:

100%
Accepted

Test #56:

score: 19
Accepted
time: 0ms
memory: 14068kb

input:

14 1000000
494185
494185 494185
494185 494185 494185
494185 494185 494185 494185
494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 494185 494185 494185
494185 494185 494185 494185 494185 49...

output:

26
1 11 536641
1 12 536641
0 12 536641
10 11 536641
9 11 536641
8 11 536641
7 11 536641
6 11 536641
5 11 536641
4 11 536641
3 11 536641
2 11 536641
1 13 536641
1 11 505815
1 12 505815
0 12 505815
10 11 505815
9 11 505815
8 11 505815
7 11 505815
6 11 505815
5 11 505815
4 11 505815
3 11 505815
2 11 50...

result:

ok 

Test #57:

score: 19
Accepted
time: 0ms
memory: 13960kb

input:

37 1000000
891050
891050 891050
891050 891050 891050
891050 891050 891050 891050
891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 891050 891050 891050
891050 891050 891050 891050 891050 89...

output:

NO

result:

ok 

Test #58:

score: 19
Accepted
time: 3ms
memory: 14368kb

input:

40 1000000
824509
824509 824509
824509 824509 824509
824509 824509 824509 824509
824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 824509 824509 824509
824509 824509 824509 824509 824509 82...

output:

78
28 32 175491
16 32 175491
17 32 175491
18 32 175491
19 32 175491
20 32 175491
21 32 175491
22 32 175491
23 32 175491
24 32 175491
25 32 175491
26 32 175491
27 32 175491
15 32 175491
29 32 175491
30 32 175491
31 32 175491
0 33 175491
1 33 175491
2 33 175491
3 33 175491
4 33 175491
5 33 175491
6 33...

result:

ok 

Test #59:

score: 19
Accepted
time: 3ms
memory: 14176kb

input:

40 1000000
209146
209146 209146
209146 209146 209146
209146 209146 209146 209146
209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 209146 209146 209146
209146 209146 209146 209146 209146 20...

output:

78
28 32 806691
16 32 806691
17 32 806691
18 32 806691
19 32 806691
20 32 806691
21 32 806691
22 32 806691
23 32 806691
24 32 806691
25 32 806691
26 32 806691
27 32 806691
15 32 806691
29 32 806691
30 32 806691
31 32 806691
0 33 806691
1 33 806691
2 33 806691
3 33 806691
4 33 806691
5 33 806691
6 33...

result:

ok 

Test #60:

score: 19
Accepted
time: 0ms
memory: 14084kb

input:

40 1000000
750045
750045 750045
750045 750045 750045
750045 750045 750045 750045
750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 750045 750045 750045
750045 750045 750045 750045 750045 75...

output:

NO

result:

ok 

Test #61:

score: 19
Accepted
time: 0ms
memory: 14500kb

input:

74 1000000
883981
883981 883981
883981 883981 883981
883981 883981 883981 883981
883981 883981 883981 883981 883981
883981 883981 883981 883981 883981 883981
883981 883981 883981 883981 883981 883981 883981
883981 883981 883981 883981 883981 883981 883981 883981
883981 883981 883981 883981 883981 88...

output:

146
34 60 259437
24 60 259437
25 60 259437
26 60 259437
27 60 259437
28 60 259437
29 60 259437
30 60 259437
31 60 259437
32 60 259437
33 60 259437
23 60 259437
35 60 259437
36 60 259437
37 60 259437
38 60 259437
39 60 259437
40 60 259437
41 60 259437
42 60 259437
43 60 259437
44 60 259437
13 60 2594...

result:

ok 

Test #62:

score: 19
Accepted
time: 40ms
memory: 18656kb

input:

293 1000000
699926
699926 699926
699926 699926 699926
699926 699926 699926 699926
699926 699926 699926 699926 699926
699926 699926 699926 699926 699926 699926
699926 699926 699926 699926 699926 699926 699926
699926 699926 699926 699926 699926 699926 699926 699926
699926 699926 699926 699926 699926 6...

output:

NO

result:

ok 

Test #63:

score: 19
Accepted
time: 88ms
memory: 19260kb

input:

387 1000000
771151
771151 771151
771151 771151 771151
771151 771151 771151 771151
771151 771151 771151 771151 771151
771151 771151 771151 771151 771151 771151
771151 771151 771151 771151 771151 771151 771151
771151 771151 771151 771151 771151 771151 771151 771151
771151 771151 771151 771151 771151 7...

output:

772
20 316 228849
29 316 228849
28 316 228849
27 316 228849
26 316 228849
25 316 228849
24 316 228849
23 316 228849
22 316 228849
21 316 228849
30 316 228849
19 316 228849
18 316 228849
17 316 228849
16 316 228849
15 316 228849
14 316 228849
13 316 228849
12 316 228849
39 316 228849
47 316 228849
46...

result:

ok 

Test #64:

score: 19
Accepted
time: 183ms
memory: 19616kb

input:

498 1000000
419303
419303 419303
419303 419303 419303
419303 419303 419303 419303
419303 419303 419303 419303 419303
419303 419303 419303 419303 419303 419303
419303 419303 419303 419303 419303 419303 419303
419303 419303 419303 419303 419303 419303 419303 419303
419303 419303 419303 419303 419303 4...

output:

994
281 406 941592
296 406 941592
295 406 941592
294 406 941592
293 406 941592
292 406 941592
291 406 941592
290 406 941592
289 406 941592
288 406 941592
287 406 941592
286 406 941592
285 406 941592
284 406 941592
283 406 941592
282 406 941592
297 406 941592
280 406 941592
279 406 941592
278 406 941...

result:

ok 

Test #65:

score: 19
Accepted
time: 177ms
memory: 23612kb

input:

500 1000000
399243
399243 399243
399243 399243 399243
399243 399243 399243 399243
399243 399243 399243 399243 399243
399243 399243 399243 399243 399243 399243
399243 399243 399243 399243 399243 399243 399243
399243 399243 399243 399243 399243 399243 399243 399243
399243 399243 399243 399243 399243 3...

output:

NO

result:

ok 

Test #66:

score: 19
Accepted
time: 37ms
memory: 18888kb

input:

284 1000000
635345
635345 635345
635345 635345 635345
635345 635345 635345 635345
635345 635345 635345 635345 635345
635345 635345 635345 635345 635345 635345
635345 635345 635345 635345 635345 635345 635345
635345 635345 635345 635345 635345 635345 635345 635345
635345 635345 635345 635345 635345 6...

output:

566
229 231 364655
220 231 364655
221 231 364655
222 231 364655
223 231 364655
224 231 364655
225 231 364655
226 231 364655
227 231 364655
228 231 364655
219 231 364655
230 231 364655
0 232 364655
1 232 364655
2 232 364655
3 232 364655
4 232 364655
5 232 364655
6 232 364655
7 232 364655
209 231 3646...

result:

ok 

Test #67:

score: 19
Accepted
time: 168ms
memory: 19488kb

input:

483 1000000
403419
522267 471978
212936 940257 76971
334161 459947 694156 708157
806463 550365 700576 825569 726608
753985 6603 550332 602239 34358 185981
693778 208464 362256 672765 752997 40852 929118
916573 640331 114992 791071 487912 368137 275916 741475
719830 62722 401844 942381 111164 453890 ...

output:

NO

result:

ok 

Test #68:

score: 19
Accepted
time: 170ms
memory: 21676kb

input:

497 1000000
580648
580648 580648
580648 580648 580648
580648 580648 580648 580648
580648 580648 580648 580648 580648
580648 580648 580648 580648 580648 580648
580648 580648 580648 580648 580648 580648 580648
580648 580648 580648 580648 580648 580648 580648 580648
580648 580648 580648 580648 580648 5...

output:

992
356 405 419352
371 405 419352
370 405 419352
369 405 419352
368 405 419352
367 405 419352
366 405 419352
365 405 419352
364 405 419352
363 405 419352
362 405 419352
361 405 419352
360 405 419352
359 405 419352
358 405 419352
357 405 419352
372 405 419352
355 405 419352
354 405 419352
353 405 419...

result:

ok 

Test #69:

score: 19
Accepted
time: 188ms
memory: 23608kb

input:

500 1000000
557164
840277 711833
290274 26166 463977
521625 200536 365050 218569
527722 75647 921083 441762 905345
721686 163907 707268 264697 727595 480411
440243 460247 604508 503960 370022 148498 281212
116447 255431 423763 724292 221159 968701 583391 868361
148302 166379 32628 912700 46956 22759...

output:

NO

result:

ok 

Test #70:

score: 19
Accepted
time: 184ms
memory: 19700kb

input:

500 1000000
221407
221407 221407
221407 221407 221407
221407 221407 221407 221407
221407 221407 221407 221407 221407
221407 221407 221407 221407 221407 221407
221407 221407 221407 221407 221407 221407 221407
221407 221407 221407 221407 221407 221407 221407 221407
221407 221407 221407 221407 221407 2...

output:

998
134 408 778593
149 408 778593
148 408 778593
147 408 778593
146 408 778593
145 408 778593
144 408 778593
143 408 778593
142 408 778593
141 408 778593
140 408 778593
139 408 778593
138 408 778593
137 408 778593
136 408 778593
135 408 778593
150 408 778593
133 408 778593
132 408 778593
131 408 778...

result:

ok 

Test #71:

score: 19
Accepted
time: 179ms
memory: 19620kb

input:

500 1000000
773628
833544 773628
346056 346056 346056
788373 773628 788373 346056
701641 701641 701641 346056 701641
830530 773628 830530 346056 788373 701641
507760 507760 507760 346056 507760 507760 507760
315780 315780 315780 315780 315780 315780 315780 315780
707756 707756 707756 346056 707756 7...

output:

998
134 408 999725
149 408 999725
148 408 999725
147 408 999725
146 408 999725
145 408 999725
144 408 999725
143 408 999725
142 408 999725
141 408 999725
140 408 999725
139 408 999725
138 408 999725
137 408 999725
136 408 999725
135 408 999725
150 408 999725
133 408 999725
132 408 999725
131 408 999...

result:

ok 

Test #72:

score: 19
Accepted
time: 172ms
memory: 21752kb

input:

500 1000000
650078
560539 560539
560539 560539 650078
560539 560539 560539 560539
560539 560539 560539 560539 650078
560539 560539 560539 560539 560539 560539
560539 560539 560539 560539 560539 560539 650078
560539 560539 560539 560539 560539 560539 560539 560539
560539 560539 560539 560539 560539 5...

output:

998
134 408 439461
149 408 439461
148 408 439461
147 408 439461
146 408 439461
145 408 439461
144 408 439461
143 408 439461
142 408 439461
141 408 439461
140 408 439461
139 408 439461
138 408 439461
137 408 439461
136 408 439461
135 408 439461
150 408 439461
133 408 439461
132 408 439461
131 408 439...

result:

ok 

Test #73:

score: 19
Accepted
time: 177ms
memory: 23772kb

input:

500 1000000
585835
173900 173900
585835 890308 173900
173900 173900 283544 173900
565192 565192 173900 565192 173900
509953 509953 173900 509953 173900 509953
509953 509953 173900 509953 173900 509953 663260
509953 509953 173900 509953 173900 509953 663260 929326
173900 173900 283544 173900 753869 1...

output:

998
134 408 998437
149 408 998437
148 408 998437
147 408 998437
146 408 998437
145 408 998437
144 408 998437
143 408 998437
142 408 998437
141 408 998437
140 408 998437
139 408 998437
138 408 998437
137 408 998437
136 408 998437
135 408 998437
150 408 998437
133 408 998437
132 408 998437
131 408 998...

result:

ok 

Test #74:

score: 19
Accepted
time: 183ms
memory: 23488kb

input:

500 1000000
662192
662192 769210
662192 755840 755840
662192 769210 794208 755840
662192 769210 813864 755840 794208
662192 769210 794208 755840 824417 794208
662192 755840 755840 858373 755840 755840 755840
662192 769210 826589 755840 794208 813864 794208 755840
662192 769210 812227 755840 794208 8...

output:

NO

result:

ok 

Test #75:

score: 19
Accepted
time: 178ms
memory: 19516kb

input:

500 1000000
748977
720005 720005
0 0 0
748977 751079 720005 0
0 0 0 491274 0
0 0 0 491274 0 679920
515161 515161 515161 0 515161 0 0
0 0 0 491274 0 684691 679920 0
0 0 0 491274 0 684691 679920 0 760030
515161 515161 515161 0 515161 0 0 551311 0 0
748977 762034 720005 0 751079 0 0 515161 0 0 515161
2...

output:

NO

result:

ok 

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%