結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
FVRChan
|
| 提出日時 | 2017-09-29 09:05:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 358 bytes |
| コンパイル時間 | 621 ms |
| コンパイル使用メモリ | 67,992 KB |
| 実行使用メモリ | 6,816 KB |
| 最終ジャッジ日時 | 2024-11-15 19:45:07 |
| 合計ジャッジ時間 | 1,545 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 WA * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | int n;scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:12:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | for(int i=0;i<n;i++)scanf("%d",&x[i]);
| ~~~~~^~~~~~~~~~~~
ソースコード
#include<iostream>
#include<queue>
#include<cstdio>
#include<utility>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
int n;scanf("%d",&n);
int *x=new int[n];
int mv=999999999;
for(int i=0;i<n;i++)scanf("%d",&x[i]);
sort(x,x+n);
for(int i=0;i<n-1;i++){
if(x[i] != x[i+1]){
mv=min(abs(x[i]-x[i+1]),mv);
}
}cout<<mv<<endl;
}
FVRChan