結果

問題 No.135 とりあえず1次元の問題
ユーザー しめはじめしめはじめ
提出日時 2019-07-12 15:10:16
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 744 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 28,724 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-11 02:32:44
合計ジャッジ時間 1,470 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
4,384 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 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 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 13 ms
4,380 KB
testcase_22 AC 14 ms
4,380 KB
evil01.txt AC 12 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

    int i, j;
    int x;
    //int pos[n];
    char pos[1000001];
    int max = 0;
    long min = 1000000;
    int d = 0;
    int from = -1;

    for( i = 0; i <= 1000000; i++ ){
        pos[i] = 'o';
    }
    for( i = 0; i < n; i++ ){
        scanf( "%d", &x );
        pos[x] = 'x';
        //printf( "%d %d\n", i, x );
        if( x > max  ){
            max = x;
        }
    }

    for( i = 0; i <= max; i++ ){
        if( pos[i] == 'x' ){
            if( from >= 0 ){
                d = i - from;
                if( d > 0 && d < min ){
                    min = d;
                }
            }
            from = i;
        }
    }
    printf( "%d\n", min );
}
0