QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#654703#9446. Construction of Townucup-team1074WA 1ms3664kbC++231.4kb2024-10-18 21:58:262024-10-18 21:58:30

Judging History

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

  • [2024-10-18 21:58:30]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3664kb
  • [2024-10-18 21:58:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define x first
#define y second 
#define endl '\n'
const LL maxn = 4e05+7;
const LL N = 5e05+10;
const LL mod = 1e09+7;
const int inf = 0x3f3f3f3f;
const LL llinf = 5e18;
typedef pair<int,int>pl;
priority_queue<LL , vector<LL>, greater<LL> >mi;//小根堆
priority_queue<LL> ma;//大根堆
void solve() 
{
	int n , m;
	cin >> n >> m;
	int w[m];
	for(int i = 0 ; i < m ; i ++){
		cin >> w[i];
	}	
	int l = 1 , r = 2;
	cout << 1 << " " << 2 << endl;
	int mp[n + 5][n + 5];
	memset(mp , 0 , sizeof mp);
	mp[1][2] = 1;
	for(int i = 1 ; i < n - 1 ; i ++){
		if(i & 1){
			cout << l << " " << i + 2 << endl;
			mp[l][i + 2] = 1;
			mp[i + 2][l] = 1;
			l = i + 2;
		}
		else{
			cout << r << " " << i + 2 << endl;
			mp[r][i + 2] = 1;
			mp[i + 2][r] = 1;
			r = i + 2;
		}
	}
	if(m > n - 1){
		cout << n << " " << n - 1 << endl;
		mp[n][n - 1] = 1;
		mp[n - 1][n] = 1;
		m--;
		for(int i = 1 ; i <= n ; i ++){
			for(int j = i + 1 ; j <= n ; j ++){
				if(m == n - 1){
					break;
				}
				if(mp[i][j] == 0){
					cout << i << " " << j << endl;
					m--;
				}
			}
		}
	}
}            
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    int t=1;
    while(t--)
    {
    	solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 2
4 5

output:

1 2
1 3

result:

ok Output is valid. OK

Test #2:

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

input:

4 6
12 34 56

output:

1 2
1 3
2 4
4 3
1 4
2 3

result:

ok Output is valid. OK

Test #3:

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

input:

2 1
998244353

output:

1 2

result:

ok Output is valid. OK

Test #4:

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

input:

3 3
1 10

output:

1 2
1 3
3 2

result:

ok Output is valid. OK

Test #5:

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

input:

5 8
242843383 518993849 724779449 840953559

output:

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

result:

ok Output is valid. OK

Test #6:

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

input:

18 126
39410019 70345886 168856428 197802912 223783647 344488232 415354650 469999573 493792726 559747189 594518379 618889840 837969745 887889232 902719782 939226057 964201045

output:

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

result:

ok Output is valid. OK

Test #7:

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

input:

12 31
174263514 197758195 292740096 306679313 354005933 398452388 398606647 491039633 498460549 752927114 935265367

output:

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

result:

ok Output is valid. OK

Test #8:

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

input:

13 32
122545743 189485128 264451311 268677647 376349244 415768107 484672476 484831061 580845312 831171754 962403493 976528835

output:

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

result:

ok Output is valid. OK

Test #9:

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

input:

83 268
1336404 1638431 29867112 37846434 39974806 67762497 87471774 89098975 123220330 129829959 130430771 138690618 185540843 189154640 192769291 193128697 202502273 207666259 208735561 211395003 213284371 238692857 255846890 259549555 274725003 282077340 303702628 304036353 344659436 361578645 394...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
52 54
...

result:

ok Output is valid. OK

Test #10:

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

input:

42 129
6757829 12333570 16293166 35067566 38029597 47750616 55888460 58139055 71872810 111665754 126452297 144320564 159142216 183349841 188315652 287043393 325383843 348678569 366638842 459460958 486899020 493818239 513644529 554658320 582073996 652589042 655863952 698542558 704000906 814561475 831...

output:

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

result:

ok Output is valid. OK

Test #11:

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

input:

3 3
467864974 559610430

output:

1 2
1 3
3 2

result:

ok Output is valid. OK

Test #12:

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

input:

38 388
21759743 97148258 132587306 148394260 162714451 254494468 258548697 261968008 296954526 298915833 328650259 354138924 380568180 397933732 403032341 501527473 574840676 601132549 635312175 643780611 653631534 683192083 691464057 792564486 808148563 833813653 863995685 878264018 888011892 89204...

output:

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

result:

ok Output is valid. OK

Test #13:

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

input:

53 770
6653478 22132917 48542298 62784851 114934854 134109855 147794451 155855102 158964149 178136455 200237055 208635288 209883438 240795375 254701590 257480253 269052269 277308536 284951513 291055063 291546181 313844915 320234930 347186864 411700470 416491798 428633768 434657921 454897984 45654594...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
53 52
...

result:

ok Output is valid. OK

Test #14:

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

input:

60 152
7975999 12984773 15741049 21041041 56609379 98568829 137705036 167571219 168586632 185080208 185315745 218418128 234115276 244830767 265489641 278108333 292024914 299862000 304328646 333498983 348788328 375716156 388164298 394677281 400395332 407376765 419321962 426486532 430492044 431479312 ...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
52 54
...

result:

ok Output is valid. OK

Test #15:

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

input:

84 1411
1273304 11793267 17115608 22511889 24665799 28126151 28498143 43412629 50412460 75614158 79436120 93739922 96858161 99908075 102174385 102507501 131471147 197125784 210462782 217305060 231473618 242489147 261553144 269817517 279969550 281954722 295281159 307613980 311547870 331712919 3323140...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
52 54
...

result:

ok Output is valid. OK

Test #16:

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

input:

7 16
42883547 263010861 645369637 671422514 861321482 902186898

output:

1 2
1 3
2 4
3 5
4 6
5 7
7 6
1 4
1 5
1 6
1 7
2 3
2 5
2 6
2 7
3 4

result:

ok Output is valid. OK

Test #17:

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

input:

70 2363
22614888 54921036 64855065 84028338 98468671 115822735 116511194 122363441 124516299 130399451 163277435 171118199 200714176 210391564 219182959 255482358 256371517 258833877 269582841 269703772 272461320 293770460 326795080 329831148 335216767 346760885 380320105 401387130 404993270 4389766...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
52 54
...

result:

ok Output is valid. OK

Test #18:

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

input:

77 662
44182627 46655958 61347544 63265732 63813532 74467923 111043197 116973969 124438572 133015666 133981168 135847253 139722736 158499893 184886697 196905857 199438731 211974935 224131544 227099690 243861700 246331140 255928964 265717640 276013045 292534767 299915404 301480087 302744056 315146548...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
52 54
...

result:

ok Output is valid. OK

Test #19:

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

input:

74 1886
29786281 64455006 80903943 85008962 105117974 112005919 118196436 126814468 127782666 142047831 159330693 159620462 175337680 187643350 214055634 254326613 260866298 279338706 289007344 291935655 292005136 322291141 322370693 365013974 395421450 412480957 425008787 425770337 446379400 460164...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
52 54
...

result:

ok Output is valid. OK

Test #20:

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

input:

99 4085
1 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
52 54
...

result:

ok Output is valid. OK

Test #21:

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

input:

71 1870
1 1 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10...

output:

1 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9
8 10
9 11
10 12
11 13
12 14
13 15
14 16
15 17
16 18
17 19
18 20
19 21
20 22
21 23
22 24
23 25
24 26
25 27
26 28
27 29
28 30
29 31
30 32
31 33
32 34
33 35
34 36
35 37
36 38
37 39
38 40
39 41
40 42
41 43
42 44
43 45
44 46
45 47
46 48
47 49
48 50
49 51
50 52
51 53
52 54
...

result:

ok Output is valid. OK

Test #22:

score: -100
Wrong Answer
time: 0ms
memory: 3528kb

input:

8 12
1 1 1000000000 1000000000 1000000000 1000000000 1000000000

output:

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

result:

wrong answer graph is not optimal.