結果

問題 No.135 とりあえず1次元の問題
ユーザー temp
提出日時 2015-02-16 12:16:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 647 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 73,876 KB
実行使用メモリ 7,372 KB
最終ジャッジ日時 2025-01-03 05:18:57
合計ジャッジ時間 1,833 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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