結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-15 00:11:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 291 bytes |
| コンパイル時間 | 1,436 ms |
| コンパイル使用メモリ | 166,936 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-20 01:00:35 |
| 合計ジャッジ時間 | 1,976 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 2 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:17:11: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
17 | cout << ans << endl;
| ^~~
main.cpp:7:7: note: 'ans' was declared here
7 | int ans;
| ^~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int ans;
for (int i = 0; i < N; i++) {
int x, y;
cin >> x >> y;
if (i && y - x != ans) {
cout << -1 << endl;
return 0;
}
ans = y - x;
}
cout << ans << endl;
return 0;
}