Submission #68676605


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
using i64 = long long;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;

    while (T-- > 0) {
        int M, K;
        cin >> M >> K;

        if (K == M) {
            cout << "Yes\n" << M << '\n';

            for (int i = 0; i < M; ++i)
                cout << i << ' ';

            cout << '\n';
        } else if (K & 1) {
            cout << "Yes\n" << (K + 1) / 2 << '\n';

            for (int i = 0; i <= (K - 1) / 2; ++i)
                cout << i << ' ';

            cout << '\n';
        } else if (K == 2)
            M & 1 ? cout << "No\n" : cout << "Yes\n2\n0 " << M / 2 << '\n';
        else if (K == 4)
            M & 3 ? cout << "No\n" : cout << "Yes\n3\n0 " << M / 4 << ' ' << M / 2 << '\n';
        else {
            cout << "Yes\n" << K / 2 << "\n0 ";

            for (int i = 2; i <= K / 2; ++i)
                cout << i << ' ';

            cout << '\n';
        }
    }

    return 0;
}

Submission Info

Submission Time
Task D - |A + A|
User GApple
Language C++ 23 (Clang 16.0.6)
Score 700
Code Size 1057 Byte
Status AC
Exec Time 31 ms
Memory 3612 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 1
AC × 24
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 3 ms 3532 KiB
01_random_00.txt AC 8 ms 3612 KiB
01_random_01.txt AC 5 ms 3460 KiB
01_random_02.txt AC 5 ms 3440 KiB
01_random_03.txt AC 5 ms 3612 KiB
01_random_04.txt AC 31 ms 3476 KiB
01_random_05.txt AC 3 ms 3480 KiB
01_random_06.txt AC 3 ms 3520 KiB
01_random_07.txt AC 3 ms 3548 KiB
01_random_08.txt AC 3 ms 3492 KiB
01_random_09.txt AC 3 ms 3480 KiB
01_random_10.txt AC 1 ms 3484 KiB
01_random_11.txt AC 1 ms 3612 KiB
01_random_12.txt AC 1 ms 3512 KiB
01_random_13.txt AC 1 ms 3404 KiB
01_random_14.txt AC 1 ms 3536 KiB
01_random_15.txt AC 1 ms 3456 KiB
01_random_16.txt AC 1 ms 3488 KiB
01_random_17.txt AC 1 ms 3432 KiB
01_random_18.txt AC 1 ms 3468 KiB
01_random_19.txt AC 1 ms 3544 KiB
01_random_20.txt AC 4 ms 3332 KiB
01_random_21.txt AC 3 ms 3472 KiB
01_random_22.txt AC 3 ms 3412 KiB