結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
daradara_sanma
|
| 提出日時 | 2017-07-07 23:54:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 405 bytes |
| コンパイル時間 | 1,080 ms |
| コンパイル使用メモリ | 58,200 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-06 10:09:33 |
| 合計ジャッジ時間 | 867 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
int main() {
int n;
cin >> n;
int ans = 0;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
int temp = y - x;
if (temp > 0)
{
if (i == 0)
{
ans = temp;
}
else if (ans != temp)
{
ans = -1;
break;
}
}
else
{
ans = -1;
break;
}
}
cout << ans << endl;
return 0;
}
daradara_sanma