結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2019-01-08 22:44:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 288 bytes |
コンパイル時間 | 683 ms |
コンパイル使用メモリ | 64,980 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-24 00:49:31 |
合計ジャッジ時間 | 1,158 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 1 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:21:17: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 21 | cout << ans << endl; | ^~~ main.cpp:12:13: note: 'ans' was declared here 12 | int ans; | ^~~
ソースコード
#include <iostream> #define rep(i, n) for (int i = 0; i < n; i++) using namespace std; const int INF = 1e9; int main() { int n; cin >> n; int ans; rep(i, n) { int x, y; cin >> x >> y; int z = y - x; ans = (i == 0 && z > 0 || ans == z) ? z : -1; } cout << ans << endl; }