結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
gotutiyan
|
| 提出日時 | 2017-11-21 16:47:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 904 bytes |
| コンパイル時間 | 786 ms |
| コンパイル使用メモリ | 92,208 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-26 08:11:59 |
| 合計ジャッジ時間 | 1,303 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:55:17: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
55 | cout << ans << endl;
| ^~~
main.cpp:31:13: note: 'ans' was declared here
31 | int ans;
| ^~~
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <fstream>
#include <set>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>
#include <sstream>
#include <list>
#include <map>
#include <stdlib.h>
#include <time.h>
#define rep(i,p,n) for(int i=(int)p;i<(int)n;i++)
#define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--)
#define Sort(x) sort(x.begin(),x.end());
#define ll long long
#define INF 2000000000
using namespace std;
int main() {
int n;
bool st = true;
int ans;
cin >> n;
rep(i, 0, n) {
int a, b;
cin >> a >> b;
if (b - a <= 0) {
cout << -1 << endl;
return 0;
}
else {
if (st) {
ans = b - a;
st = false;
}
else {
if (ans != b - a) {
cout << -1 << endl;
return 0;
}
}
}
}
cout << ans << endl;
return 0;
}
gotutiyan