提出 #73329314


ソースコード 拡げる

#include<stdio.h>
#include<string.h>
/* 1<=N<=500000 */

int main(void) {
    int n;
    scanf("%d", &n);
    int a[n];
    char b[1000000];

    for (int i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }

    int next;
    char chart[20];
    for (int s=0; s<n; s++) {
        next = a[s];
        while (next!=a[next-1]) {
            next = a[next-1];
        }
        sprintf(chart, "%d", next);
        strcat(b, chart);
        strcat(b, " ");
    }
    printf("%s\n", b);
}

提出情報

提出日時
問題 C - Sugoroku Destination
ユーザ null_beta
言語 C23 (GCC 14.2.0)
得点 0
コード長 508 Byte
結果 TLE
実行時間 > 2000 ms
メモリ 4612 KiB

コンパイルエラー

Main.c: In function ‘main’:
Main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
Main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d", &a[i]);
      |         ^~~~~~~~~~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 300
結果
AC × 3
AC × 4
TLE × 14
セット名 テストケース
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 2692 KiB
00_sample_01.txt AC 1 ms 2624 KiB
00_sample_02.txt AC 1 ms 2740 KiB
01_random_03.txt TLE > 2000 ms 4612 KiB
01_random_04.txt TLE > 2000 ms 4504 KiB
01_random_05.txt TLE > 2000 ms 4456 KiB
01_random_06.txt TLE > 2000 ms 4532 KiB
01_random_07.txt TLE > 2000 ms 4456 KiB
01_random_08.txt TLE > 2000 ms 4448 KiB
01_random_09.txt TLE > 2000 ms 4448 KiB
01_random_10.txt TLE > 2000 ms 4608 KiB
01_random_11.txt TLE > 2000 ms 3168 KiB
01_random_12.txt TLE > 2000 ms 3156 KiB
01_random_13.txt TLE > 2000 ms 4308 KiB
01_random_14.txt TLE > 2000 ms 2664 KiB
01_random_15.txt TLE > 2000 ms 4496 KiB
01_random_16.txt AC 1 ms 2688 KiB
01_random_17.txt TLE > 2000 ms 4508 KiB