Submission #74600981


Source Code Expand

#include <iostream>
#include <vector>
using namespace std;

int main()
{
  int n, k, q;  // マスの数 駒の数 操作回数
  cin >> n >> k >> q;
  vector<int> komaPos(k);  // 駒位置 操作
  int op ;//i番目の駒

  for (int i = 0; i < k; i++) {
    cin >> komaPos[i];  // sort済み
    komaPos[i]--;       // 0index
  }

  for (int i = 0; i < q; i++) {
    cin >> op;  
    op--;// 操作対象の駒の番号

    if (komaPos[op] == n - 1) {
    /*一番右のマスにいるかなら何もしない*/ }
    else if (komaPos[op + 1] == komaPos[op] + 1) {  // その右に駒がいるなら何もしない
    }
    else {
      komaPos[op]++;
    }
  }

  for (int i = 0; i < k; i++) {
    //1index
    cout << komaPos[i] + 1 << " ";
  }
  return 0;
}

Submission Info

Submission Time
Task D - 1D Pawn
User Nishiki_1
Language C++23 (GCC 15.2.0)
Score 200
Code Size 804 Byte
Status AC
Exec Time 1 ms
Memory 3668 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 19
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3464 KiB
example_01.txt AC 1 ms 3464 KiB
example_02.txt AC 1 ms 3496 KiB
hand_00.txt AC 1 ms 3644 KiB
hand_01.txt AC 1 ms 3412 KiB
hand_02.txt AC 1 ms 3504 KiB
hand_03.txt AC 1 ms 3400 KiB
hand_04.txt AC 1 ms 3460 KiB
hand_05.txt AC 1 ms 3416 KiB
random_00.txt AC 1 ms 3444 KiB
random_01.txt AC 1 ms 3644 KiB
random_02.txt AC 1 ms 3612 KiB
random_03.txt AC 1 ms 3460 KiB
random_04.txt AC 1 ms 3544 KiB
random_05.txt AC 1 ms 3504 KiB
random_06.txt AC 1 ms 3468 KiB
random_07.txt AC 1 ms 3412 KiB
random_08.txt AC 1 ms 3668 KiB
random_09.txt AC 1 ms 3516 KiB