結果

問題 No.135 とりあえず1次元の問題
ユーザー GOTKAKO
提出日時 2025-07-13 17:49:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 460 bytes
コンパイル時間 1,551 ms
コンパイル使用メモリ 194,872 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-13 17:49:16
合計ジャッジ時間 2,808 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N; cin >> N;
    vector<int>  ap(1001001);
    while(N--){
        int x; cin >> x;
        ap.at(x)++;
    }
    int back = -1001001,answer = 10010001;
    for(int i=0; i<=1000000; i++){
        if(ap.at(i) == N){answer = 0; break;}
        if(ap.at(i) > 0) answer = min(answer,i-back),back = i;
    }
    cout << answer << endl;
}
0