結果

問題 No.178 美しいWhitespace (1)
ユーザー wing3196
提出日時 2015-04-05 23:28:50
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 77,116 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 02:10:39
合計ジャッジ時間 1,402 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;
#define int long long

signed main(){
	int N;
	cin>>N;
	int size[1000], ma = 0;
	for(int i=0;i<N;i++){
		int A,B;
		cin>>A>>B;
		ma = max(ma,size[i] = A+B*4);
	}
	int ans = 0;
	for(int i=0;i<N;i++){
		if((ma-size[i])&1!=0){
			ans = -1; break;
		}
		ans += (ma-size[i])/2;
	}
	printf("%lld\n",ans);
	return 0;
}
0