結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-13 17:50:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 21 ms / 5,000 ms |
| コード長 | 472 bytes |
| コンパイル時間 | 1,856 ms |
| コンパイル使用メモリ | 194,748 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-07-13 17:50:36 |
| 合計ジャッジ時間 | 3,435 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<int> ap(1001001);
for(int i=0; i<N; i++){
int x; cin >> x;
ap.at(x)++;
}
int back = -1001001,answer = 10010001;
for(int i=0; i<=1000000; i++){
if(ap.at(i) == N){answer = 0; break;}
if(ap.at(i) > 0) answer = min(answer,i-back),back = i;
}
cout << answer << endl;
}