QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#188468#7178. BishopsDAleksaWA 0ms3548kbC++141.2kb2023-09-25 21:07:012023-09-25 21:07:01

Judging History

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

  • [2023-09-25 21:07:01]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3548kb
  • [2023-09-25 21:07:01]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    if(n == m) {
        cout << n + m - 2 << "\n";
        for(int i = 1; i <= n - 1; i++) cout << "1 " << i << "\n" << m << " " << i << "\n";
        return 0;
    }
    bool swapped = false;
    if(n > m) {
        swap(n, m);
        swapped = true;
    }
    if(true) {
        vector<pair<int, int>> res;
        for(int i = 1; i <= n; i++) res.push_back({i, 1});
        for(int i = 1; i <= n; i++) res.push_back({i, m});
        int start = (n + 1) / 2 + 2, finish = m - (n + 1) / 2 - 1;
        for(int i = start; i <= finish; i++) res.push_back({(n + 1) / 2, i});
        if(swapped) {
            for(int i = 0; i < res.size(); i++) {
                swap(res[i].first, res[i].second);
            }
        }
        cout << res.size() << "\n";
        for(int i = 0; i < res.size(); i++) cout << res[i].first << " " << res[i].second << "\n";
        return 0;
    }
//    vector<pair<int, int>> res;
//    for(int i = 1; i <= n; i++) res.push_back({i, 1});
//    for(int i = 1; i <= n; i++) res.push_back({i, m});
//    int start = n / 2 + 1, fini
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 5

output:

5
1 1
2 1
1 5
2 5
1 3

result:

wrong answer Participant's answer is not optimal (5 < 6)