結果
問題 | No.716 距離 |
ユーザー |
![]() |
提出日時 | 2018-07-27 22:27:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 969 bytes |
コンパイル時間 | 616 ms |
コンパイル使用メモリ | 70,348 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 01:27:06 |
合計ジャッジ時間 | 1,625 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:30:13: warning: overflow in conversion from ‘long int’ to ‘int’ changes value from ‘10000000000’ to ‘1410065408’ [-Woverflow] 30 | d = 10000000000; | ^~~~~~~~~~~
ソースコード
#include<iostream>#include <algorithm>#include<string>#include <bitset>#include <vector>#include <functional>#include <climits>#include <iomanip>#include <utility>using namespace std;typedef pair <int, int> pii;int main(){//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;//cout << LONG_MAX << endl;string s, t;//long long n, A[1000000000];long long n, m;//int y[100001], z[100001], x[10001] = {};//pii y[100001];//pair<int, float> pii[100001];int x[1003];cin >> n;for ( a = 0; a < n; a++){cin >> x[a];}d = 10000000000;for ( a = 0; a < n; a++){for ( b = 0; b < n; b++){if (a!=b){c = max(abs(x[a] - x[b]), c);d = min(abs(x[a] - x[b]), d);}}}////std::cout << std::fixed;//cout << std::setprecision(20) << << endl;cout << d << endl;cout << c << endl;return 0;}