結果

問題 No.185 和風
ユーザー sggkshio
提出日時 2016-08-12 00:08:24
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 80,948 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-07 11:10:33
合計ジャッジ時間 1,258 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
//#include<bits/stdc++.h>


using namespace std;



int main(){

	int n;
	cin>>n;
	int a=0;
	bool f=1;
	for(int i=0;i<n;i++){
		int x,y;
		cin>>x>>y;
		if(i==0)a=y-x;
		if(a!=y-x)f=0;
		if(a<0)f=0;
	}
	if(!f)a=-1;
	cout<<a<<endl;
	return 0;

	}


	
0