QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#783096#9799. Magical PalettemangoxuanWA 0ms3780kbC++142.1kb2024-11-25 23:18:122024-11-25 23:18:17

Judging History

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

  • [2024-11-25 23:18:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3780kb
  • [2024-11-25 23:18:12]
  • 提交

answer

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    if (n == 1 && m == 1)
    {
        cout << "Yes\n0\n0";
        return 0;
    }
    if (n == m)
    {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
    if (n % 2 && m % 2)
    {
        if (n < m)
        {
            for (int i = 1; i <= n; i++)
                cout << i << ' ';
            cout << '\n';
            for (int i = 1; i <= (m - 1) * n + 1; i += n)
                cout << i << ' ';
            cout << '\n';
        }
        else
        {
            swap(n, m);
            for (int i = 1; i <= (m - 1) * n + 1; i += n)
                cout << i << ' ';
            cout << '\n';
            for (int i = 1; i <= n; i++)
                cout << i << ' ';
            cout << '\n';
        }
    }
    else
    {
        int a = min(n, m), b = max(n, m);
        vector<int> x, y;
        if (a % 2)
        {
            for (int i = 1, j = 1; i <= a; i++, j += 2)
                x.push_back(j);
            for (int i = 1, j = 1; i <= b; i++, j += a)
                y.push_back(j);
            if (m < n)
                swap(x, y);
            for (auto c : x)
                cout << c << ' ';
            cout << '\n';
            for (auto c : y)
                cout << c << ' ';
            cout << '\n';
        }
        else
        {
            if (n < m)
            {
                for (int i = 1; i <= n; i++)
                    cout << i << ' ';
                cout << '\n';
                for (int i = 1; i <= (m - 1) * n + 1; i += n)
                    cout << i << ' ';
                cout << '\n';
            }
            else
            {
                swap(n, m);
                for (int i = 1; i <= (m - 1) * n + 1; i += n)
                    cout << i << ' ';
                cout << '\n';
                for (int i = 1; i <= n; i++)
                    cout << i << ' ';
                cout << '\n';
            }
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 3
2 2

output:

No

result:

wrong answer Wrong Verdict (test case 1)