Submission #66808610


Source Code Expand

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

int main () {
  ios_base::sync_with_stdio(0); cin.tie(0);
  int T;
  cin >> T;
  while (T--) {
    int m, k;
    cin >> m >> k;
    vector<int> a;
    if (k == m) {
      a.resize(m);
      iota(a.begin(), a.end(), 0);
    }
    else if (k%2 == 1) {
      for (int i = 0; i <= k/2; i++) a.push_back(i);
    }
    else if (k%2 == 0 && k > 4) {
      for (int i = 0; i < k/2-1; i++) {
        a.push_back(i);
      }
      a.push_back(k/2);
    }
    else if (k == 4 && m%4 == 0) {
      a = {0, m/4, m/2};
    }
    else if (k == 2 && m%2 == 0) {
      a = {0, m/2};
    }

    if (a.empty()) {
      cout << "No\n";
    }
    else {
      cout << "Yes\n";
      cout << a.size() << '\n';
      for (auto& x: a) cout << x << ' ';
      cout << '\n';
    }
  }
}

Submission Info

Submission Time
Task D - |A + A|
User AndrewG
Language C++ 23 (gcc 12.2)
Score 700
Code Size 850 Byte
Status AC
Exec Time 35 ms
Memory 3800 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 1 ms 3520 KiB
01_random_00.txt AC 8 ms 3696 KiB
01_random_01.txt AC 5 ms 3700 KiB
01_random_02.txt AC 5 ms 3800 KiB
01_random_03.txt AC 5 ms 3756 KiB
01_random_04.txt AC 35 ms 3468 KiB
01_random_05.txt AC 4 ms 3324 KiB
01_random_06.txt AC 3 ms 3400 KiB
01_random_07.txt AC 3 ms 3608 KiB
01_random_08.txt AC 3 ms 3448 KiB
01_random_09.txt AC 3 ms 3392 KiB
01_random_10.txt AC 1 ms 3416 KiB
01_random_11.txt AC 1 ms 3408 KiB
01_random_12.txt AC 1 ms 3464 KiB
01_random_13.txt AC 1 ms 3464 KiB
01_random_14.txt AC 1 ms 3468 KiB
01_random_15.txt AC 1 ms 3480 KiB
01_random_16.txt AC 1 ms 3464 KiB
01_random_17.txt AC 1 ms 3408 KiB
01_random_18.txt AC 1 ms 3420 KiB
01_random_19.txt AC 1 ms 3472 KiB
01_random_20.txt AC 4 ms 3692 KiB
01_random_21.txt AC 4 ms 3596 KiB
01_random_22.txt AC 3 ms 3520 KiB