結果

問題 No.135 とりあえず1次元の問題
ユーザー しめはじめしめはじめ
提出日時 2019-07-12 15:04:50
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 765 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 28,624 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-08-11 02:23:47
合計ジャッジ時間 1,139 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 13 ms
4,376 KB
testcase_22 WA -
evil01.txt AC 12 ms
4,380 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 ){
                from = i;
            }else{
                d = i - from;
                if( d > 0 && d < min ){
                    min = d;
                }
            }
        }
    }
    printf( "%d\n", min );
}
0