Submission #49499753


Source Code Expand

#include <iostream>
#include <vector>

int main(){
  int N;
  std::cin >> N;
  std::vector<long> revA(N+1);
  for(int i = 0; i < N; ++i){
    int Ai;
    std::cin >> Ai;
    if(Ai == -1){
      revA[0] = i;
    }
    else {
      revA[Ai] = i;
    }
  }
  std::cout << revA[0] + 1 << " ";
  int stat = revA[0] + 1;
  for(int i = 0; i < N - 1; ++i){
    std::cout << revA[stat] + 1 << " ";
    stat = revA[stat]+1;
  }
  std::cout << std::endl;
  return 0;
}

Submission Info

Submission Time
Task C - Lining Up 2
User Rachman
Language C++ 20 (gcc 12.2)
Score 300
Code Size 484 Byte
Status AC
Exec Time 78 ms
Memory 5608 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 32
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 01_handmade_07.txt, 01_handmade_08.txt, 01_handmade_09.txt, 01_handmade_10.txt, 01_handmade_11.txt, 01_handmade_12.txt, 01_handmade_13.txt, 01_handmade_14.txt, 01_handmade_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt, 02_random_23.txt, 02_random_24.txt, 02_random_25.txt, 02_random_26.txt, 02_random_27.txt, 02_random_28.txt, 02_random_29.txt, 02_random_30.txt, 02_random_31.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3388 KiB
00_sample_01.txt AC 1 ms 3532 KiB
00_sample_02.txt AC 1 ms 3676 KiB
01_handmade_03.txt AC 68 ms 5540 KiB
01_handmade_04.txt AC 68 ms 5532 KiB
01_handmade_05.txt AC 69 ms 5464 KiB
01_handmade_06.txt AC 69 ms 5524 KiB
01_handmade_07.txt AC 1 ms 3476 KiB
01_handmade_08.txt AC 1 ms 3476 KiB
01_handmade_09.txt AC 1 ms 3540 KiB
01_handmade_10.txt AC 1 ms 3612 KiB
01_handmade_11.txt AC 1 ms 3532 KiB
01_handmade_12.txt AC 1 ms 3612 KiB
01_handmade_13.txt AC 1 ms 3608 KiB
01_handmade_14.txt AC 1 ms 3536 KiB
01_handmade_15.txt AC 1 ms 3448 KiB
02_random_16.txt AC 77 ms 5512 KiB
02_random_17.txt AC 78 ms 5436 KiB
02_random_18.txt AC 76 ms 5608 KiB
02_random_19.txt AC 77 ms 5548 KiB
02_random_20.txt AC 78 ms 5552 KiB
02_random_21.txt AC 77 ms 5516 KiB
02_random_22.txt AC 77 ms 5608 KiB
02_random_23.txt AC 77 ms 5444 KiB
02_random_24.txt AC 28 ms 3908 KiB
02_random_25.txt AC 21 ms 3860 KiB
02_random_26.txt AC 7 ms 3532 KiB
02_random_27.txt AC 43 ms 4424 KiB
02_random_28.txt AC 36 ms 4120 KiB
02_random_29.txt AC 42 ms 4620 KiB
02_random_30.txt AC 75 ms 5548 KiB
02_random_31.txt AC 46 ms 4820 KiB