結果

問題 No.135 とりあえず1次元の問題
ユーザー しめはじめしめはじめ
提出日時 2019-07-12 14:40:30
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 490 bytes
コンパイル時間 843 ms
コンパイル使用メモリ 28,796 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-08-11 01:41:03
合計ジャッジ時間 26,115 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 0 ms
4,380 KB
testcase_12 AC 0 ms
4,380 KB
testcase_13 AC 0 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 0 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 TLE -
testcase_22 TLE -
evil01.txt TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void){
    int n;
    scanf( "%d", &n );

    int i, j;
    int x;
    int pos[n];
    long min = 1000000;
    int d = 0;

    for( i = 0; i < n; i++ ){
        scanf( "%d", &x );
        pos[i] = x;
    }
    for( i = 0; i < n; i++ ){
        for( j = i + 1; j < n; j++ ){
            d = pos[i] - pos[j];
            d = d < 0 ? d * -1 : d;
            if( d > 0 && d < min ){
                min = d;
            }
        }
    }
    printf( "%d\n", min );
}
0