結果

問題 No.135 とりあえず1次元の問題
ユーザー temptemp
提出日時 2015-02-16 12:16:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 647 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 70,148 KB
実行使用メモリ 7,256 KB
最終ジャッジ日時 2023-09-01 02:56:16
合計ジャッジ時間 2,017 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
6,004 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 4 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 4 ms
4,380 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 4 ms
4,380 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 5 ms
4,696 KB
testcase_13 AC 4 ms
4,380 KB
testcase_14 AC 5 ms
5,480 KB
testcase_15 AC 5 ms
4,428 KB
testcase_16 AC 5 ms
5,924 KB
testcase_17 AC 5 ms
5,668 KB
testcase_18 AC 4 ms
4,380 KB
testcase_19 AC 5 ms
5,432 KB
testcase_20 AC 5 ms
5,028 KB
testcase_21 AC 35 ms
4,376 KB
testcase_22 AC 39 ms
7,256 KB
evil01.txt AC 34 ms
7,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <string>

using namespace std;

int x[1000001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    x[t] = 1;
  }
  if (n <= 1) {
    std::cout << 0 << std::endl;
    return 0;
  }
  int ans = 2e9;
  int p = 0;
  while (!x[p]) p++;
  for (int i = p+1; i <= 1000000; i++) {
    if (x[i]) {
      ans = min(ans, i-p);
      p = i;
    }
  }
  std::cout << ans << std::endl;
}
0