QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#133297#3269. 末日魔法少女计划zhouhuanyi0 4ms4064kbC++231.1kb2023-08-01 22:23:142023-08-01 22:23:18

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-01 22:23:18]
  • 评测
  • 测评结果:0
  • 用时:4ms
  • 内存:4064kb
  • [2023-08-01 22:23:14]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<vector>
#define N 100000
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
struct reads
{
	int x,y;
};
reads tong[N+1];
int n,k,length;
void adder(int x,int y)
{
	tong[++length]=(reads){x,y};
	return;
}
void solve(int l,int r)
{
	if (r-l<=k) return;
	int d=(r-l+1)/k,ps=l;
	vector<int>s(n+1);
	vector<int>used(n+1);
	vector<int>p(k+1);
	for (int i=1;i<=k;++i) ps+=d,p[i]=ps,s[ps]++,used[ps]=1;
	for (int i=l;i<=r;++i) s[i]+=s[i-1];
	for (int i=1;i<=k-1;++i)
		if (p[i+1]-p[i]>1)
			adder(p[i],p[i+1]);
	for (int i=l;i<=r;++i)
		if (!used[i])
		{
			if (s[i]&&i-p[s[i]]>1) adder(p[s[i]],i);
			if (s[i]!=k&&p[s[i]+1]-i>1) adder(i,p[s[i]+1]);
		}
	if (l<=p[1]-1) solve(l,p[1]-1);
	for (int i=1;i<=k-1;++i)
		if (p[i]+1<=p[i+1]-1)
			solve(p[i]+1,p[i+1]-1);
	if (p[k]+1<=r) solve(p[k]+1,r);
	return;
}
int main()
{
	n=read(),k=read(),solve(1,n),printf("%d\n",length);
	for (int i=1;i<=length;++i) printf("%d %d\n",tong[i].x,tong[i].y);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 4ms
memory: 4064kb

input:

2000 2

output:

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

result:

wrong answer Integer 2001 violates the range [1003, 2000]

Subtask #2:

score: 0
Wrong Answer

Test #6:

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

input:

1936 3

output:

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

result:

wrong answer Not correct

Subtask #3:

score: 0
Wrong Answer

Test #11:

score: 0
Wrong Answer
time: 2ms
memory: 3804kb

input:

2000 4

output:

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

result:

wrong answer Integer 2001 violates the range [1503, 2000]

Subtask #4:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 2ms
memory: 3792kb

input:

2000 5

output:

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

result:

wrong answer Integer 2001 violates the range [1603, 2000]

Subtask #5:

score: 0
Wrong Answer

Test #21:

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

input:

2000 6

output:

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

result:

wrong answer Not correct

Subtask #6:

score: 0
Wrong Answer

Test #26:

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

input:

1999 7

output:

9569
286 571
571 856
856 1141
1141 1426
1426 1711
1711 1996
1 286
2 286
3 286
4 286
5 286
6 286
7 286
8 286
9 286
10 286
11 286
12 286
13 286
14 286
15 286
16 286
17 286
18 286
19 286
20 286
21 286
22 286
23 286
24 286
25 286
26 286
27 286
28 286
29 286
30 286
31 286
32 286
33 286
34 286
35 286
36 2...

result:

wrong answer Not correct

Subtask #7:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 2ms
memory: 3736kb

input:

1995 8

output:

8994
250 499
499 748
748 997
997 1246
1246 1495
1495 1744
1744 1993
1 250
2 250
3 250
4 250
5 250
6 250
7 250
8 250
9 250
10 250
11 250
12 250
13 250
14 250
15 250
16 250
17 250
18 250
19 250
20 250
21 250
22 250
23 250
24 250
25 250
26 250
27 250
28 250
29 250
30 250
31 250
32 250
33 250
34 250
35 ...

result:

wrong answer Not correct

Subtask #8:

score: 0
Wrong Answer

Test #36:

score: 0
Wrong Answer
time: 2ms
memory: 3748kb

input:

1997 9

output:

8185
222 443
443 664
664 885
885 1106
1106 1327
1327 1548
1548 1769
1769 1990
1 222
2 222
3 222
4 222
5 222
6 222
7 222
8 222
9 222
10 222
11 222
12 222
13 222
14 222
15 222
16 222
17 222
18 222
19 222
20 222
21 222
22 222
23 222
24 222
25 222
26 222
27 222
28 222
29 222
30 222
31 222
32 222
33 222
...

result:

wrong answer Not correct

Subtask #9:

score: 0
Wrong Answer

Test #41:

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

input:

1995 10

output:

7757
200 399
399 598
598 797
797 996
996 1195
1195 1394
1394 1593
1593 1792
1792 1991
1 200
2 200
3 200
4 200
5 200
6 200
7 200
8 200
9 200
10 200
11 200
12 200
13 200
14 200
15 200
16 200
17 200
18 200
19 200
20 200
21 200
22 200
23 200
24 200
25 200
26 200
27 200
28 200
29 200
30 200
31 200
32 200...

result:

wrong answer Not correct

Subtask #10:

score: 0
Wrong Answer

Test #46:

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

input:

1993 11

output:

7401
182 363
363 544
544 725
725 906
906 1087
1087 1268
1268 1449
1449 1630
1630 1811
1811 1992
1 182
2 182
3 182
4 182
5 182
6 182
7 182
8 182
9 182
10 182
11 182
12 182
13 182
14 182
15 182
16 182
17 182
18 182
19 182
20 182
21 182
22 182
23 182
24 182
25 182
26 182
27 182
28 182
29 182
30 182
31 ...

result:

wrong answer Not correct

Subtask #11:

score: 0
Wrong Answer

Test #51:

score: 0
Wrong Answer
time: 2ms
memory: 3772kb

input:

1999 12

output:

7054
167 333
333 499
499 665
665 831
831 997
997 1163
1163 1329
1329 1495
1495 1661
1661 1827
1827 1993
1 167
2 167
3 167
4 167
5 167
6 167
7 167
8 167
9 167
10 167
11 167
12 167
13 167
14 167
15 167
16 167
17 167
18 167
19 167
20 167
21 167
22 167
23 167
24 167
25 167
26 167
27 167
28 167
29 167
30...

result:

wrong answer Not correct

Subtask #12:

score: 0
Wrong Answer

Test #56:

score: 0
Wrong Answer
time: 2ms
memory: 3768kb

input:

1981 13

output:

6939
153 305
305 457
457 609
609 761
761 913
913 1065
1065 1217
1217 1369
1369 1521
1521 1673
1673 1825
1825 1977
1 153
2 153
3 153
4 153
5 153
6 153
7 153
8 153
9 153
10 153
11 153
12 153
13 153
14 153
15 153
16 153
17 153
18 153
19 153
20 153
21 153
22 153
23 153
24 153
25 153
26 153
27 153
28 153...

result:

wrong answer Not correct

Subtask #13:

score: 0
Wrong Answer

Test #61:

score: 0
Wrong Answer
time: 1ms
memory: 3840kb

input:

1979 14

output:

6990
142 283
283 424
424 565
565 706
706 847
847 988
988 1129
1129 1270
1270 1411
1411 1552
1552 1693
1693 1834
1834 1975
1 142
2 142
3 142
4 142
5 142
6 142
7 142
8 142
9 142
10 142
11 142
12 142
13 142
14 142
15 142
16 142
17 142
18 142
19 142
20 142
21 142
22 142
23 142
24 142
25 142
26 142
27 14...

result:

wrong answer Not correct

Subtask #14:

score: 0
Wrong Answer

Test #66:

score: 0
Wrong Answer
time: 2ms
memory: 3820kb

input:

2000 15

output:

6803
134 267
267 400
400 533
533 666
666 799
799 932
932 1065
1065 1198
1198 1331
1331 1464
1464 1597
1597 1730
1730 1863
1863 1996
1 134
2 134
3 134
4 134
5 134
6 134
7 134
8 134
9 134
10 134
11 134
12 134
13 134
14 134
15 134
16 134
17 134
18 134
19 134
20 134
21 134
22 134
23 134
24 134
25 134
26...

result:

wrong answer Not correct