結果
| 問題 | 
                            No.185 和風
                             | 
                    
| コンテスト | |
| ユーザー | 
                             prog470
                         | 
                    
| 提出日時 | 2016-09-17 14:00:57 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 581 bytes | 
| コンパイル時間 | 1,142 ms | 
| コンパイル使用メモリ | 68,284 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-17 08:17:02 | 
| 合計ジャッジ時間 | 1,710 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 WA * 3 | 
ソースコード
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
int main() {
	int N, X[1005], Y[1005];
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> X[i] >> Y[i];
	}
	int ans = 0;
	for (int i = 0; i < N; i++) {
		ans = Y[i] - X[i];
		if (i > 0) {
			if (ans != Y[i] - X[i]) {
				cout << -1 << endl;
				return 0;
			}
		}
	}
	if (ans <= 0) cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}
            
            
            
        
            
prog470