結果
問題 |
No.135 とりあえず1次元の問題
|
ユーザー |
|
提出日時 | 2015-11-29 21:44:38 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 639 bytes |
コンパイル時間 | 587 ms |
コンパイル使用メモリ | 64,052 KB |
実行使用メモリ | 10,404 KB |
最終ジャッジ日時 | 2025-01-03 10:31:29 |
合計ジャッジ時間 | 31,878 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 2 |
other | WA * 18 TLE * 4 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ ios::sync_with_stdio(false); int n, input, d, min=10000000; int x[100000]; int bDiffer=0; cin >> n; for(int i=0; i<100000; ++i) x[i]=min; for(int i=0; i<n; ++i){ cin >> input; x[i]=input; cout << "input :" << input << "\tnow :" << i << "\n"; } cout << "input complete.\n"; cout << "sort complete.\n"; for(int i=0; i<n-1; ++i){ for(int j=i+1; j<n; ++j){ d=x[i]-x[j]; d *= (d<0) ? -1 : 1; if(d!=0 && min>d){ min=d; bDiffer=1; } } } cout << min*bDiffer << "\n"; return 0; }