結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2015-02-22 16:38:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 20 ms / 5,000 ms |
コード長 | 306 bytes |
コンパイル時間 | 534 ms |
コンパイル使用メモリ | 42,228 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 05:19:13 |
合計ジャッジ時間 | 1,561 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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);std::sort(b,b+a); | ~~~~~^~~~~~~~~~
ソースコード
#include<stdio.h> #include<algorithm> using namespace std; int b[111111]; 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-1]!=b[i])ret=min(ret,b[i]-b[i-1]); if(ret>99999999)printf("0\n"); else printf("%d\n",ret); }