QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#311155#7178. BishopsMinhhoWA 1ms3808kbC++17996b2024-01-21 23:38:022024-01-21 23:38:03

Judging History

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

  • [2024-01-21 23:38:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3808kb
  • [2024-01-21 23:38:02]
  • 提交

answer

#define taskname "D"
#include <bits/stdc++.h>
#define ii pair<int,int>
#define ff first
#define ss second

using namespace std;
int n, m;

/**
- Leftmost column
- Rightmost column
- In the middle
**/

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    cin>>n>>m;
    bool sw = 0;
    if (n > m) swap(n, m), sw = 1;
    vector<ii> ans;
    for (int i=1; i<=n; i++) ans.emplace_back(i, 1);
    for (int i=1+(n==m); i<=n-(n==m); i++) ans.emplace_back(i, m);
    if (n & 1)
    {
        int mid = (n+1)/2;
        int st = mid + 1, ed = m - mid;
        for (int i=st; i<=ed; i++) ans.emplace_back(mid, i);
    }
    else
    {
        int mid = n/2;
        int st = n, ed = m - n;
        for (int i=st; i<=ed; i+=2) ans.emplace_back(mid, i), ans.emplace_back(mid+1, i);
    }
    cout<<ans.size()<<"\n";
    for (auto [i, j]: ans)
    {
        if (sw) swap(i, j);
        cout<<i<<" "<<j<<"\n";
    }
}

詳細信息

Test #1:

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

input:

2 5

output:

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

result:

wrong answer Sum diagonals are not distinct