QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#335147#7178. BishopscoolplumWA 0ms3528kbC++17998b2024-02-22 19:52:222024-02-22 19:52:22

Judging History

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

  • [2024-02-22 19:52:22]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3528kb
  • [2024-02-22 19:52:22]
  • 提交

answer

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

int s(int n, int m)
{
    if (m%n==0)
        return 1;

    return 1+n-m%n;
}

int e(int n, int m)
{
    if (m%n==0)
        return n-1;

    return m%n-2;
}

int main()
{
    int m, n;
    vector<pair<int, int> > h, v;
    cin >> m >> n;
    for (int i=0; i<m; i=i+n)
        for (int j=0; j<n; j++)
            h.push_back({i+1, j+1});
    for (int j=s(n, m); j<e(n, m); j++)
        h.push_back({m, j+1});
    swap(m, n);
    for (int i=0; i<m; i=i+n)
        for (int j=0; j<n; j++)
            v.push_back({i+1, j+1});
    for (int j=s(n, m); j<e(n, m); j++)
        v.push_back({m, j+1});
    if (v.size()>h.size())
    {
        cout << v.size() << '\n';
        for (auto x : v)
            cout << x.first << ' ' << x.second << '\n';
    }
    else
    {
        cout << h.size() << '\n';
        for (auto x : h)
            cout << x.second << ' ' << x.first << '\n';
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 5

output:

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

result:

wrong answer Integer parameter [name=x] equals to 3, violates the range [1, 2]