結果

問題 No.135 とりあえず1次元の問題
ユーザー haraduka_haraduka_
提出日時 2015-01-25 23:46:56
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,148 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 87,320 KB
実行使用メモリ 7,560 KB
最終ジャッジ日時 2023-08-31 01:24:49
合計ジャッジ時間 1,816 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,292 KB
testcase_01 AC 5 ms
7,340 KB
testcase_02 AC 5 ms
7,528 KB
testcase_03 AC 4 ms
7,284 KB
testcase_04 AC 5 ms
7,284 KB
testcase_05 AC 5 ms
7,292 KB
testcase_06 AC 5 ms
7,356 KB
testcase_07 AC 5 ms
7,296 KB
testcase_08 AC 4 ms
7,488 KB
testcase_09 AC 5 ms
7,296 KB
testcase_10 AC 5 ms
7,280 KB
testcase_11 AC 5 ms
7,560 KB
testcase_12 AC 5 ms
7,332 KB
testcase_13 AC 4 ms
7,352 KB
testcase_14 AC 5 ms
7,312 KB
testcase_15 AC 6 ms
7,328 KB
testcase_16 AC 5 ms
7,284 KB
testcase_17 AC 4 ms
7,276 KB
testcase_18 AC 4 ms
7,280 KB
testcase_19 AC 5 ms
7,276 KB
testcase_20 AC 4 ms
7,352 KB
testcase_21 WA -
testcase_22 AC 18 ms
7,280 KB
evil01.txt AC 16 ms
7,408 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;
    }
    if(n == 1) cout << 0 << endl;
    else{
        int res = 1e6;
        int now = -1;
        rep(i, 1e6+1){
            if(x[i]){
                if(now == -1){
                    now = i;
                }else{
                    res = min(res, i - now);
                    now = i;
                }
            }
        }
        if(res == 1e6) res = 0;
        cout << res << endl;
    }

}
0