結果
| 問題 | No.185 和風 |
| コンテスト | |
| ユーザー |
toshiro_yanagi
|
| 提出日時 | 2019-01-08 22:45:18 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 290 bytes |
| 記録 | |
| コンパイル時間 | 596 ms |
| コンパイル使用メモリ | 73,564 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-17 20:24:34 |
| 合計ジャッジ時間 | 1,608 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:19:42: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
19 | ans = ((i == 0 && z > 0) || ans == z) ? z : -1;
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
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;
}
toshiro_yanagi