結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
![]() |
提出日時 | 2015-01-25 23:42:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,116 bytes |
コンパイル時間 | 779 ms |
コンパイル使用メモリ | 90,708 KB |
実行使用メモリ | 7,552 KB |
最終ジャッジ日時 | 2025-01-03 03:05:24 |
合計ジャッジ時間 | 1,756 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 21 WA * 1 |
ソースコード
#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; } }