結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2015-12-28 22:55:42 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 19 ms / 5,000 ms |
コード長 | 314 bytes |
コンパイル時間 | 599 ms |
コンパイル使用メモリ | 42,092 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-03 11:03:26 |
合計ジャッジ時間 | 1,390 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | int a;scanf("%d",&a); | ~~~~~^~~~~~~~~ main.cpp:7:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | for(int i=0;i<a;i++)scanf("%d",b+i); | ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h> #include<algorithm> using namespace std; int b[110000]; int main(){ int a;scanf("%d",&a); for(int i=0;i<a;i++)scanf("%d",b+i); std::sort(b,b+a); int ret=999999999; for(int i=1;i<a;i++){ if(b[i]==b[i-1])continue; ret=min(ret,b[i]-b[i-1]); } if(ret>99999999)ret=0; printf("%d\n",ret); }