結果
問題 | No.185 和風 |
ユーザー |
|
提出日時 | 2015-04-20 00:22:39 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 518 bytes |
コンパイル時間 | 1,591 ms |
コンパイル使用メモリ | 157,784 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 15:56:18 |
合計ジャッジ時間 | 2,027 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) #define FOR(i, f, t) for(int(i)=(f);(i)<(t);(++i)) int main(){ do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0); int N; cin >> N; ll x,y; cin >> x >> y; ll z = y - x; ll res = z; if(z < 1) res = -1; if(z > 0){ REP(i,N-1){ cin >> x >> y; if(z + x != y) res = -1; } } cout << res << endl; }