結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
AQUA16573837
|
| 提出日時 | 2018-03-13 00:55:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 416 ms |
| コンパイル使用メモリ | 32,688 KB |
| 最終ジャッジ日時 | 2024-11-14 20:23:31 |
| 合計ジャッジ時間 | 1,043 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:9: error: ‘scanf’ was not declared in this scope
9 | scanf("%d", &n);
| ^~~~~
main.cpp:19:17: error: ‘printf’ was not declared in this scope
19 | printf("%d\n", mind);
| ^~~~~~
main.cpp:3:1: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
2 | #include <deque>
+++ |+#include <cstdio>
3 | using namespace std;
main.cpp:21:17: error: ‘printf’ was not declared in this scope
21 | printf("%d\n", 0);
| ^~~~~~
main.cpp:21:17: note: ‘printf’ is defined in header ‘<cstdio>’; did you forget to ‘#include <cstdio>’?
ソースコード
#include <algorithm>
#include <deque>
using namespace std;
using ll = long long;
//135
int main() {
int n, x[100000];
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", x + i);
sort(x, x + n);
int mind = 1e9;
for (int i = 1; i < n; i++)
if (x[i - 1] != x[i])
mind = min(mind, abs(x[i] - x[i - 1]));
if (mind != 1e9)
printf("%d\n", mind);
else
printf("%d\n", 0);
}
AQUA16573837