結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,280 KB
testcase_01 AC 5 ms
7,548 KB
testcase_02 AC 4 ms
7,392 KB
testcase_03 WA -
testcase_04 AC 5 ms
7,280 KB
testcase_05 AC 5 ms
7,408 KB
testcase_06 AC 5 ms
7,292 KB
testcase_07 AC 5 ms
7,336 KB
testcase_08 AC 4 ms
7,288 KB
testcase_09 AC 4 ms
7,288 KB
testcase_10 AC 5 ms
7,344 KB
testcase_11 AC 5 ms
7,340 KB
testcase_12 AC 5 ms
7,288 KB
testcase_13 AC 4 ms
7,328 KB
testcase_14 AC 5 ms
7,484 KB
testcase_15 AC 5 ms
7,340 KB
testcase_16 AC 5 ms
7,280 KB
testcase_17 AC 5 ms
7,488 KB
testcase_18 AC 4 ms
7,372 KB
testcase_19 AC 5 ms
7,296 KB
testcase_20 AC 5 ms
7,348 KB
testcase_21 AC 14 ms
7,280 KB
testcase_22 AC 17 ms
7,356 KB
evil01.txt AC 15 ms
7,292 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;
                }
            }
        }
        cout << res << endl;
    }

}
0