提出 #73294808


ソースコード 拡げる

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

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;

using i128 = __int128;
using u128 = unsigned __int128;

mt19937_64 mrand((u64)random_device{}() << 32 ^ random_device{}() ^
	chrono::high_resolution_clock::now().time_since_epoch().count());
template<class T = i64,class T2>T rnd(T l,T2 r){
return uniform_int_distribution<T>(l,r)(mrand);}

int main (){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);

	int n;
	cin >> n;

	vector<int> a(n + 1),ans(n + 1);

	for (int i = 1;i <= n;i++)
		cin >> a[i],ans[i] = i;

	for (int i = n;i;i--)
		ans[i] = ans[a[i]];

	for (int i = 1;i <= n;i++)
		cout << ans[i] << ' ';
}

提出情報

提出日時
問題 C - Sugoroku Destination
ユーザ zyx2012
言語 C++23 (GCC 15.2.0)
得点 300
コード長 722 Byte
結果 AC
実行時間 31 ms
メモリ 8020 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 18
セット名 テストケース
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_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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3596 KiB
00_sample_01.txt AC 1 ms 3620 KiB
00_sample_02.txt AC 1 ms 3596 KiB
01_random_03.txt AC 30 ms 7884 KiB
01_random_04.txt AC 31 ms 7964 KiB
01_random_05.txt AC 30 ms 7884 KiB
01_random_06.txt AC 30 ms 7888 KiB
01_random_07.txt AC 30 ms 8020 KiB
01_random_08.txt AC 30 ms 7876 KiB
01_random_09.txt AC 30 ms 7888 KiB
01_random_10.txt AC 30 ms 7852 KiB
01_random_11.txt AC 12 ms 4824 KiB
01_random_12.txt AC 10 ms 4696 KiB
01_random_13.txt AC 27 ms 7196 KiB
01_random_14.txt AC 3 ms 3784 KiB
01_random_15.txt AC 30 ms 7852 KiB
01_random_16.txt AC 1 ms 3508 KiB
01_random_17.txt AC 30 ms 7884 KiB