結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
re1ns
|
| 提出日時 | 2015-11-06 15:49:09 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 343 bytes |
| 記録 | |
| コンパイル時間 | 376 ms |
| コンパイル使用メモリ | 71,148 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-06 13:16:29 |
| 合計ジャッジ時間 | 1,469 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 17 |
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/string:53,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/locale_classes.h:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ios_base.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:46,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
In function 'const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]',
inlined from 'int main()' at main.cpp:15:20:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/stl_algobase.h:239:7: warning: 'd' may be used uninitialized [-Wmaybe-uninitialized]
239 | if (__b < __a)
| ^~
main.cpp: In function 'int main()':
main.cpp:9:9: note: 'd' was declared here
9 | int d,d_max=INT_MAX;
| ^
ソースコード
#include<iostream>
#include<climits>
#include<cstdlib>
using namespace std;
int main(){
int n;
cin >> n;
int x[n];
int d,d_max=INT_MAX;
cin >> x[0];
for(int i=1;i<n;i++){
cin >> x[i];
if(x[i]!=x[i-1])d = x[i]-x[i-1];
if(d<0)d*=-1;
d_max = min(d,d_max);
}
cout << d_max <<endl;
}
re1ns