結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
hamray
|
| 提出日時 | 2017-11-17 22:34:23 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 603 bytes |
| コンパイル時間 | 558 ms |
| コンパイル使用メモリ | 72,452 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-25 08:53:47 |
| 合計ジャッジ時間 | 975 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<math.h>
#include<stack>
using namespace std;
int main(void){
int N; cin >> N;
int X, Y, cnt = 0;
for(int i = 0; i < N; i++){
cin >> X >> Y;
if(i == 0) {
cnt = Y - X;
}else{
if(cnt == Y - X){
continue;
}else{
cnt = -1;
break;
}
}
}
if(cnt <= 0){
cout << -1 << endl;
}else{
cout << cnt << endl;
}
return 0;
}
hamray