結果
問題 |
No.716 距離
|
ユーザー |
👑 |
提出日時 | 2022-08-09 22:02:47 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 790 bytes |
コンパイル時間 | 687 ms |
コンパイル使用メモリ | 75,748 KB |
最終ジャッジ日時 | 2025-01-30 19:49:44 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:50:7: warning: ‘max’ may be used uninitialized [-Wmaybe-uninitialized] 50 | max += a_next; | ~~~~^~~~~~~~~ main.cpp:24:6: note: ‘max’ was declared here 24 | ll max; | ^~~
ソースコード
#include <iostream> #include <list> #include <vector> #include <string> #include <stdio.h> #include <stdint.h> #include <iomanip> using namespace std; using uint = unsigned int; using ll = long long; #define CIN( LL , A ) LL A; cin >> A #define GETLINE( A ) string A; getline( cin , A ) #define FOR_ITR( ARRAY , ITR , END ) for( auto ITR = ARRAY .begin() , END = ARRAY .end() ; ITR != END ; ITR ++ ) int main() { CIN( ll , N ); ll a_prev; ll a_next; ll min = 200001; ll max; for( ll i = 0 ; i < N ; i++ ){ cin >> a_next; if( i == 0 ){ max = - a_next; } else { ll d = a_next - a_prev; if( d < min ){ min = d; } } a_prev = a_next; } max += a_next; cout << min << endl; cout << max << endl; return 0; }