結果

問題 No.135 とりあえず1次元の問題
ユーザー haraduka_haraduka_
提出日時 2015-01-25 23:57:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 1,080 bytes
コンパイル時間 982 ms
コンパイル使用メモリ 87,588 KB
実行使用メモリ 7,492 KB
最終ジャッジ日時 2023-08-31 01:25:13
合計ジャッジ時間 1,863 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,280 KB
testcase_01 AC 5 ms
7,328 KB
testcase_02 AC 4 ms
7,280 KB
testcase_03 AC 4 ms
7,344 KB
testcase_04 AC 4 ms
7,340 KB
testcase_05 AC 5 ms
7,336 KB
testcase_06 AC 4 ms
7,408 KB
testcase_07 AC 4 ms
7,292 KB
testcase_08 AC 4 ms
7,480 KB
testcase_09 AC 5 ms
7,336 KB
testcase_10 AC 4 ms
7,400 KB
testcase_11 AC 4 ms
7,288 KB
testcase_12 AC 4 ms
7,284 KB
testcase_13 AC 4 ms
7,400 KB
testcase_14 AC 4 ms
7,348 KB
testcase_15 AC 4 ms
7,280 KB
testcase_16 AC 4 ms
7,364 KB
testcase_17 AC 4 ms
7,284 KB
testcase_18 AC 5 ms
7,336 KB
testcase_19 AC 4 ms
7,492 KB
testcase_20 AC 4 ms
7,348 KB
testcase_21 AC 14 ms
7,340 KB
testcase_22 AC 17 ms
7,412 KB
evil01.txt AC 14 ms
7,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<functional>
#include<utility>
#include<iterator>
#include<algorithm>
#include<sstream>
#include<fstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<cstring>
#include<iomanip>
using namespace std;
#define len(val) static_cast<int>(val.size())
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
typedef pair<int, int> P;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    int x[(int)1e6+1];
    memset(x, 0, sizeof(x));
    rep(i, n){
        int tmp; cin >> tmp;
        x[tmp] = 1;
    }
    int res = -1;
    int now = -1;
    rep(i, 1e6+1){
        if(x[i]){
            if(now == -1){
                now = i;
            }else{
                if(res == -1) res = (i-now);
                else res = min(res, i - now);
                now = i;
            }
        }
    }
    cout << (res == -1 ? 0 : res) << endl;
}
0