結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
184
|
| 提出日時 | 2015-01-25 23:26:17 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 315 bytes |
| 記録 | |
| コンパイル時間 | 343 ms |
| コンパイル使用メモリ | 55,336 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-06 10:57:22 |
| 合計ジャッジ時間 | 1,367 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 22 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:16:32: warning: ignoring return value of 'const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]', declared with attribute 'nodiscard' [-Wunused-result]
16 | for(int i=1;i<n;i++)min(ans,x[i]-x[i-1]);
| ~~~^~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/algorithm:62,
from main.cpp:4:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:234:5: note: declared here
234 | min(const _Tp& __a, const _Tp& __b)
| ^~~
ソースコード
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
//namaega184
int main(){
int n,x[100003];scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&x[i]);
sort(x,x+n);
int ans=1000000001;
for(int i=1;i<n;i++)min(ans,x[i]-x[i-1]);
printf("%d\n",ans);
return 0;
}
184