結果

問題 No.178 美しいWhitespace (1)
ユーザー tkzw_21
提出日時 2015-04-05 23:24:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 1,335 ms
コンパイル使用メモリ 159,336 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-04 02:09:05
合計ジャッジ時間 2,029 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(void) {
	int n;
	cin >> n;
	vector<int> a(n),b(n);
	int l = 0;
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
		l = max(a[i]+b[i]*4,l);
	}

	int sum = 0;
	for(int i=0;i<n;i++){
		if( (l -  a[i]-b[i]*4) % 2 != 0){
			cout << -1 << endl;
			return 0;
		}
		sum += (l - a[i] - b[i] * 4)/2;
	}
	cout << sum << endl;

	return 0;
}
0