結果
| 問題 |
No.716 距離
|
| コンテスト | |
| ユーザー |
Kura
|
| 提出日時 | 2019-02-15 20:01:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 395 bytes |
| コンパイル時間 | 823 ms |
| コンパイル使用メモリ | 64,428 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 13:27:44 |
| 合計ジャッジ時間 | 2,584 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 40 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
int n,x;
cin >> n;
vector<int> a(n),b(n*(n-1)/2);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
x = 0;
for (int i = 0; i < n-1; i++) {
for (int j = i + 1; j < n; j++) {
b[x] = a[j] - a[i];
x++;
}
}
sort(b.begin(), b.end());
cout << b[0] << endl;
cout << b[n*(n - 1) / 2-1] << endl;
}
Kura