QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#206477#7178. Bishopspengpeng_fudan#WA 22ms5264kbC++141.0kb2023-10-07 20:43:482023-10-07 20:43:49

Judging History

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

  • [2023-10-07 20:43:49]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:5264kb
  • [2023-10-07 20:43:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector<pair<int,int>> ans;
void solve(){
    int n,m;cin>>n>>m;
    bool flag=false;
    if(n==m){
        for(int i=1;i<=n;i++)ans.push_back({1,i});
        for(int i=2;i<=n-1;i++)ans.push_back({n,i});
    }
    else{
        if(m<n)swap(m,n),flag=true;
        int t=0;
        for(int j=1;j<=m-n;j+=n){
            t=j;
            for(int i=1;i<=n;i++){
                ans.push_back({i,j});
            }
        }
        for(int i=1;i<=n;i++)ans.push_back({i,m});
        int p=(n+1)/2;
        for(int i=t+1;i<=m-1;i++){
            if(p-(i-t)<1&&p+(i-t)>n&&p-(m-i)<1&&p+(m-i)>n)ans.push_back({p,i});
        }
    }
    cout<<ans.size()<<"\n";
    for(int i=0;i<ans.size();i++){
        if(!flag)cout<<ans[i].first<<" "<<ans[i].second<<" "<<"\n";
        else cout<<ans[i].second<<" "<<ans[i].first<<" "<<"\n";
    }
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n=1;
    //cin>>n;
    while(n--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3400kb

input:

2 5

output:

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

result:

ok n: 2, m: 5, bishops: 6

Test #2:

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

input:

5 5

output:

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

result:

ok n: 5, m: 5, bishops: 8

Test #3:

score: 0
Accepted
time: 22ms
memory: 5232kb

input:

100000 100000

output:

199998
1 1 
1 2 
1 3 
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 23 
1 24 
1 25 
1 26 
1 27 
1 28 
1 29 
1 30 
1 31 
1 32 
1 33 
1 34 
1 35 
1 36 
1 37 
1 38 
1 39 
1 40 
1 41 
1 42 
1 43 
1 44 
1 45 
1 46 
1 47 
1 48 
1 49 
1 50 
1 ...

result:

ok n: 100000, m: 100000, bishops: 199998

Test #4:

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

input:

100000 99999

output:

199998
1 1 
1 2 
1 3 
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 23 
1 24 
1 25 
1 26 
1 27 
1 28 
1 29 
1 30 
1 31 
1 32 
1 33 
1 34 
1 35 
1 36 
1 37 
1 38 
1 39 
1 40 
1 41 
1 42 
1 43 
1 44 
1 45 
1 46 
1 47 
1 48 
1 49 
1 50 
1 ...

result:

ok n: 100000, m: 99999, bishops: 199998

Test #5:

score: 0
Accepted
time: 16ms
memory: 5264kb

input:

100000 50000

output:

149998
1 1 
1 2 
1 3 
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 23 
1 24 
1 25 
1 26 
1 27 
1 28 
1 29 
1 30 
1 31 
1 32 
1 33 
1 34 
1 35 
1 36 
1 37 
1 38 
1 39 
1 40 
1 41 
1 42 
1 43 
1 44 
1 45 
1 46 
1 47 
1 48 
1 49 
1 50 
1 ...

result:

ok n: 100000, m: 50000, bishops: 149998

Test #6:

score: 0
Accepted
time: 11ms
memory: 4172kb

input:

1 100000

output:

100000
1 1 
1 2 
1 3 
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 23 
1 24 
1 25 
1 26 
1 27 
1 28 
1 29 
1 30 
1 31 
1 32 
1 33 
1 34 
1 35 
1 36 
1 37 
1 38 
1 39 
1 40 
1 41 
1 42 
1 43 
1 44 
1 45 
1 46 
1 47 
1 48 
1 49 
1 50 
1 ...

result:

ok n: 1, m: 100000, bishops: 100000

Test #7:

score: 0
Accepted
time: 11ms
memory: 5236kb

input:

34535 99889

output:

134423
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51...

result:

ok n: 34535, m: 99889, bishops: 134423

Test #8:

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

input:

12231 97889

output:

110119
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51...

result:

ok n: 12231, m: 97889, bishops: 110119

Test #9:

score: 0
Accepted
time: 12ms
memory: 4004kb

input:

10000 100000

output:

109998
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51...

result:

ok n: 10000, m: 100000, bishops: 109998

Test #10:

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

input:

13 99999

output:

100011
1 1 
2 1 
3 1 
4 1 
5 1 
6 1 
7 1 
8 1 
9 1 
10 1 
11 1 
12 1 
13 1 
1 14 
2 14 
3 14 
4 14 
5 14 
6 14 
7 14 
8 14 
9 14 
10 14 
11 14 
12 14 
13 14 
1 27 
2 27 
3 27 
4 27 
5 27 
6 27 
7 27 
8 27 
9 27 
10 27 
11 27 
12 27 
13 27 
1 40 
2 40 
3 40 
4 40 
5 40 
6 40 
7 40 
8 40 
9 40 
10 40 ...

result:

ok n: 13, m: 99999, bishops: 100011

Test #11:

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

input:

21 99999

output:

100019
1 1 
2 1 
3 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 
1 22 
2 22 
3 22 
4 22 
5 22 
6 22 
7 22 
8 22 
9 22 
10 22 
11 22 
12 22 
13 22 
14 22 
15 22 
16 22 
17 22 
18 22 
19 22 
20 22 
21 22 
1 43 
2 43 
3 43 
4 43 
5 43 
6 43 
7 ...

result:

ok n: 21, m: 99999, bishops: 100019

Test #12:

score: 0
Accepted
time: 12ms
memory: 5052kb

input:

49999 100000

output:

149998
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51...

result:

ok n: 49999, m: 100000, bishops: 149998

Test #13:

score: 0
Accepted
time: 15ms
memory: 5256kb

input:

33333 99999

output:

133331
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51...

result:

ok n: 33333, m: 99999, bishops: 133331

Test #14:

score: 0
Accepted
time: 13ms
memory: 4216kb

input:

23342 98876

output:

122216
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51...

result:

ok n: 23342, m: 98876, bishops: 122216

Test #15:

score: 0
Accepted
time: 16ms
memory: 5264kb

input:

56713 91234

output:

147946
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51...

result:

ok n: 56713, m: 91234, bishops: 147946

Test #16:

score: 0
Accepted
time: 21ms
memory: 5248kb

input:

99995 99995

output:

199988
1 1 
1 2 
1 3 
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 23 
1 24 
1 25 
1 26 
1 27 
1 28 
1 29 
1 30 
1 31 
1 32 
1 33 
1 34 
1 35 
1 36 
1 37 
1 38 
1 39 
1 40 
1 41 
1 42 
1 43 
1 44 
1 45 
1 46 
1 47 
1 48 
1 49 
1 50 
1 ...

result:

ok n: 99995, m: 99995, bishops: 199988

Test #17:

score: 0
Accepted
time: 8ms
memory: 4000kb

input:

12345 54321

output:

66665
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51 ...

result:

ok n: 12345, m: 54321, bishops: 66665

Test #18:

score: 0
Accepted
time: 11ms
memory: 5148kb

input:

90000 92000

output:

181998
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51...

result:

ok n: 90000, m: 92000, bishops: 181998

Test #19:

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

input:

10000 70000

output:

79998
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51 ...

result:

ok n: 10000, m: 70000, bishops: 79998

Test #20:

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

input:

10000 70001

output:

80000
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51 ...

result:

ok n: 10000, m: 70001, bishops: 80000

Test #21:

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

input:

10000 80000

output:

89998
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51 ...

result:

ok n: 10000, m: 80000, bishops: 89998

Test #22:

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

input:

10000 80001

output:

90000
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51 ...

result:

ok n: 10000, m: 80001, bishops: 90000

Test #23:

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

input:

10000 80002

output:

90000
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51 ...

result:

ok n: 10000, m: 80002, bishops: 90000

Test #24:

score: -100
Wrong Answer
time: 10ms
memory: 4108kb

input:

10000 79999

output:

89997
1 1 
2 1 
3 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 
23 1 
24 1 
25 1 
26 1 
27 1 
28 1 
29 1 
30 1 
31 1 
32 1 
33 1 
34 1 
35 1 
36 1 
37 1 
38 1 
39 1 
40 1 
41 1 
42 1 
43 1 
44 1 
45 1 
46 1 
47 1 
48 1 
49 1 
50 1 
51 ...

result:

wrong answer Participant's answer is not optimal (89997 < 89998)