QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#219334#7178. Bishopseuphria#WA 19ms5296kbC++201.9kb2023-10-19 12:34:282023-10-19 12:34:29

Judging History

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

  • [2023-10-19 12:34:29]
  • 评测
  • 测评结果:WA
  • 用时:19ms
  • 内存:5296kb
  • [2023-10-19 12:34:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define endl '\n'
using ll = long long;
using ull = unsigned long long;
using PII = pair<int, int>;
using PLL = pair<ll, ll>;
const int N = 1e6 + 10;
const int M = 131;
const int INF = 0x3f3f3f3f;
const long long LNF = 0x3f3f3f3f3f3f3f3f;
const long long mod = 1e9 + 7;

void solve(){
    int n, m; cin >> n >> m;
    int nwx = 1, nwy = m, zx = 0, zy = 0;
    vector<pair<int, int>> pos;
    while(n - zx != m - zy){
        if(n - zx < m - zy){
            for(int i = nwx; i <= n; i++) pos.push_back({i, nwy});
            nwy = nwy - (n - zx);
            zy = zy + (n - zx);
        }
        else{
            for(int i = 1; i <= nwy; i++) pos.push_back({nwx, i});
            nwx = nwx + (m - zy);
            zx = zx + (m - zy);
        }
        //cout << n << ' ' << m << ' ' << res << '\n';
        //cout << n << ' ' << m << ' ' << pos.size() << ' ' << nwx << ' ' << nwy << ' ' << zx << ' ' << zy << '\n';
    }
    if(n == 1) pos.push_back({nwx, nwy});
    else if(n == 2){
        for(int i = 1; i <= nwy; i++) pos.push_back({nwx, i});
    }
    else{
        for(int i = 1; i <= nwy; i++) pos.push_back({nwx, i});
        nwx = nwx + (m - zy) - 1;
        for(int i = 2; i <= nwy - 1; i++) pos.push_back({nwx, i});
    }
    cout << pos.size() << '\n';
    for(auto [x, y] : pos) cout << x << ' ' << y << '\n';
    // int a[n + 1][m + 1];    
    // for(auto [x, y] : pos)
    //     a[x][y] = 1;
    // for(int i = 1; i <= n; i ++)
    //     for(int j = 1; j <= m; j ++)
    //         if(a[i][j] == 1)
    //             cout << 1 << " \n"[j == m];
    //         else
    //             cout << 0 << " \n"[j == m];
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(12);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
    return 0 - 0;
}

詳細信息

Test #1:

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

input:

2 5

output:

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

result:

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

Test #2:

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

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: 15ms
memory: 5164kb

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 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: 100000, bishops: 199998

Test #4:

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

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 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: 99999, bishops: 199998

Test #5:

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

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: 9ms
memory: 4112kb

input:

1 100000

output:

100000
1 100000
1 99999
1 99998
1 99997
1 99996
1 99995
1 99994
1 99993
1 99992
1 99991
1 99990
1 99989
1 99988
1 99987
1 99986
1 99985
1 99984
1 99983
1 99982
1 99981
1 99980
1 99979
1 99978
1 99977
1 99976
1 99975
1 99974
1 99973
1 99972
1 99971
1 99970
1 99969
1 99968
1 99967
1 99966
1 99965
1 99...

result:

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

Test #7:

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

input:

34535 99889

output:

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

result:

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

Test #8:

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

input:

12231 97889

output:

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

result:

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

Test #9:

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

input:

10000 100000

output:

109998
1 100000
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...

result:

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

Test #10:

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

input:

13 99999

output:

100011
1 99999
2 99999
3 99999
4 99999
5 99999
6 99999
7 99999
8 99999
9 99999
10 99999
11 99999
12 99999
13 99999
1 99986
2 99986
3 99986
4 99986
5 99986
6 99986
7 99986
8 99986
9 99986
10 99986
11 99986
12 99986
13 99986
1 99973
2 99973
3 99973
4 99973
5 99973
6 99973
7 99973
8 99973
9 99973
10 99...

result:

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

Test #11:

score: -100
Wrong Answer
time: 9ms
memory: 4224kb

input:

21 99999

output:

100018
1 99999
2 99999
3 99999
4 99999
5 99999
6 99999
7 99999
8 99999
9 99999
10 99999
11 99999
12 99999
13 99999
14 99999
15 99999
16 99999
17 99999
18 99999
19 99999
20 99999
21 99999
1 99978
2 99978
3 99978
4 99978
5 99978
6 99978
7 99978
8 99978
9 99978
10 99978
11 99978
12 99978
13 99978
14 99...

result:

wrong answer Participant's answer is not optimal (100018 < 100019)