QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#300952#7178. BishopsELDRVDAC ✓16ms9328kbC++141.5kb2024-01-09 04:01:152024-01-09 04:01:15

Judging History

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

  • [2024-01-09 04:01:15]
  • 评测
  • 测评结果:AC
  • 用时:16ms
  • 内存:9328kb
  • [2024-01-09 04:01:15]
  • 提交

answer

//https://qoj.ac/contest/1356/problem/7178
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define PI acos(-1)
#define LSB(i) ((i) & -(i))
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define sc second
#define th third
#define fo fourth
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ldb double
#define INF 1e15
#define MOD 1000000007
#define endl "\n"

#define all(data)       data.begin(),data.end()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()
#define MAXN 100007
vector<pll> v;
int main()
{
    ios::sync_with_stdio(false); cin.tie(0);
    ll n,m,x=0; cin>>n>>m;
    if(n>m) {swap(n,m); x^=1;}
    if(n==m)
    {
        for(int i=2;i<n;i++) v.pb({i,m});
        for(int i=1;i<=n;i++) v.pb({i,1});
    }
    else if(n%2==0)
    {

        for(int i=1;i<=n;i++) v.pb({i,1});
        for(int i=n/2-(m-1)%n/2+1; i<=(m-1)%n/2+n/2;i++) v.pb({i,(m-1)%n/2+n/2+1});
        for(int i=1; i<=n;i++)
        {
            for(int j=1+n+(m-1)%n;j<=m;j+=n) v.pb({i,j});
        }
    }
    else
    {
        for(int j=(n+1)/2+1;j<=m-(n+1)/2;j++) v.pb({(n+1)/2,j});
        for(int i=1;i<=n;i++) v.pb({i,1}),v.pb({i,m});
    }
    if(x)
    {
        for(auto &[mm,dd]:v) swap(mm,dd);
    }
    cout<<v.size()<<endl;
    for(auto [mm,dd]:v) cout<<mm<<" "<<dd<<endl;
    return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

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

input:

2 5

output:

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

result:

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

Test #2:

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

input:

5 5

output:

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

result:

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

Test #3:

score: 0
Accepted
time: 14ms
memory: 9092kb

input:

100000 100000

output:

199998
2 100000
3 100000
4 100000
5 100000
6 100000
7 100000
8 100000
9 100000
10 100000
11 100000
12 100000
13 100000
14 100000
15 100000
16 100000
17 100000
18 100000
19 100000
20 100000
21 100000
22 100000
23 100000
24 100000
25 100000
26 100000
27 100000
28 100000
29 100000
30 100000
31 100000
3...

result:

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

Test #4:

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

input:

100000 99999

output:

199998
1 1
100000 1
1 2
100000 2
1 3
100000 3
1 4
100000 4
1 5
100000 5
1 6
100000 6
1 7
100000 7
1 8
100000 8
1 9
100000 9
1 10
100000 10
1 11
100000 11
1 12
100000 12
1 13
100000 13
1 14
100000 14
1 15
100000 15
1 16
100000 16
1 17
100000 17
1 18
100000 18
1 19
100000 19
1 20
100000 20
1 21
100000...

result:

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

Test #5:

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

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 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

result:

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

Test #6:

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

input:

1 100000

output:

100000
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
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61
1...

result:

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

Test #7:

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

input:

34535 99889

output:

134423
17268 17269
17268 17270
17268 17271
17268 17272
17268 17273
17268 17274
17268 17275
17268 17276
17268 17277
17268 17278
17268 17279
17268 17280
17268 17281
17268 17282
17268 17283
17268 17284
17268 17285
17268 17286
17268 17287
17268 17288
17268 17289
17268 17290
17268 17291
17268 17292
17268...

result:

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

Test #8:

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

input:

12231 97889

output:

110119
6116 6117
6116 6118
6116 6119
6116 6120
6116 6121
6116 6122
6116 6123
6116 6124
6116 6125
6116 6126
6116 6127
6116 6128
6116 6129
6116 6130
6116 6131
6116 6132
6116 6133
6116 6134
6116 6135
6116 6136
6116 6137
6116 6138
6116 6139
6116 6140
6116 6141
6116 6142
6116 6143
6116 6144
6116 6145
611...

result:

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

Test #9:

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

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61...

result:

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

Test #10:

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

input:

13 99999

output:

100011
7 8
7 9
7 10
7 11
7 12
7 13
7 14
7 15
7 16
7 17
7 18
7 19
7 20
7 21
7 22
7 23
7 24
7 25
7 26
7 27
7 28
7 29
7 30
7 31
7 32
7 33
7 34
7 35
7 36
7 37
7 38
7 39
7 40
7 41
7 42
7 43
7 44
7 45
7 46
7 47
7 48
7 49
7 50
7 51
7 52
7 53
7 54
7 55
7 56
7 57
7 58
7 59
7 60
7 61
7 62
7 63
7 64
7 65
7 66
...

result:

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

Test #11:

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

input:

21 99999

output:

100019
11 12
11 13
11 14
11 15
11 16
11 17
11 18
11 19
11 20
11 21
11 22
11 23
11 24
11 25
11 26
11 27
11 28
11 29
11 30
11 31
11 32
11 33
11 34
11 35
11 36
11 37
11 38
11 39
11 40
11 41
11 42
11 43
11 44
11 45
11 46
11 47
11 48
11 49
11 50
11 51
11 52
11 53
11 54
11 55
11 56
11 57
11 58
11 59
11 60...

result:

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

Test #12:

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

input:

49999 100000

output:

149998
25000 25001
25000 25002
25000 25003
25000 25004
25000 25005
25000 25006
25000 25007
25000 25008
25000 25009
25000 25010
25000 25011
25000 25012
25000 25013
25000 25014
25000 25015
25000 25016
25000 25017
25000 25018
25000 25019
25000 25020
25000 25021
25000 25022
25000 25023
25000 25024
25000...

result:

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

Test #13:

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

input:

33333 99999

output:

133331
16667 16668
16667 16669
16667 16670
16667 16671
16667 16672
16667 16673
16667 16674
16667 16675
16667 16676
16667 16677
16667 16678
16667 16679
16667 16680
16667 16681
16667 16682
16667 16683
16667 16684
16667 16685
16667 16686
16667 16687
16667 16688
16667 16689
16667 16690
16667 16691
16667...

result:

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

Test #14:

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

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61...

result:

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

Test #15:

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

input:

56713 91234

output:

147946
28357 28358
28357 28359
28357 28360
28357 28361
28357 28362
28357 28363
28357 28364
28357 28365
28357 28366
28357 28367
28357 28368
28357 28369
28357 28370
28357 28371
28357 28372
28357 28373
28357 28374
28357 28375
28357 28376
28357 28377
28357 28378
28357 28379
28357 28380
28357 28381
28357...

result:

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

Test #16:

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

input:

99995 99995

output:

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

result:

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

Test #17:

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

input:

12345 54321

output:

66665
6173 6174
6173 6175
6173 6176
6173 6177
6173 6178
6173 6179
6173 6180
6173 6181
6173 6182
6173 6183
6173 6184
6173 6185
6173 6186
6173 6187
6173 6188
6173 6189
6173 6190
6173 6191
6173 6192
6173 6193
6173 6194
6173 6195
6173 6196
6173 6197
6173 6198
6173 6199
6173 6200
6173 6201
6173 6202
6173...

result:

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

Test #18:

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

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61...

result:

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

Test #19:

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

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 ...

result:

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

Test #20:

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

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 ...

result:

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

Test #21:

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

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 ...

result:

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

Test #22:

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

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 ...

result:

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

Test #23:

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

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 ...

result:

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

Test #24:

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

input:

10000 79999

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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 ...

result:

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

Test #25:

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

input:

10000 79998

output:

89996
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 1
52 1
53 1
54 1
55 1
56 1
57 1
58 1
59 1
60 1
61 ...

result:

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

Test #26:

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

input:

11111 100000

output:

111110
5556 5557
5556 5558
5556 5559
5556 5560
5556 5561
5556 5562
5556 5563
5556 5564
5556 5565
5556 5566
5556 5567
5556 5568
5556 5569
5556 5570
5556 5571
5556 5572
5556 5573
5556 5574
5556 5575
5556 5576
5556 5577
5556 5578
5556 5579
5556 5580
5556 5581
5556 5582
5556 5583
5556 5584
5556 5585
555...

result:

ok n: 11111, m: 100000, bishops: 111110

Test #27:

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

input:

1 1

output:

1
1 1

result:

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

Extra Test:

score: 0
Extra Test Passed