結果

問題 No.185 和風
ユーザー sggkshiosggkshio
提出日時 2016-08-12 00:08:24
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 535 ms
コンパイル使用メモリ 79,856 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 01:43:12
合計ジャッジ時間 1,036 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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