結果

問題 No.178 美しいWhitespace (1)
ユーザー hotpepsi
提出日時 2015-10-25 00:43:37
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 62,692 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 08:27:58
合計ジャッジ時間 1,416 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int main(int argc, char *argv[]) {
	int N;
	cin >> N;
	vector<int> v;
	for (int i = 0; i < N; ++i) {
		int a, b;
		cin >> a >> b;
		v.push_back(a + 4 * b);
	}
	int high = *max_element(v.begin(), v.end());
	int ans = 0;
	for (int a : v) {
		int d = high - a;
		if (d % 2) {
			ans = -1;
			break;
		}
		ans += d / 2;
	}
	cout << ans << endl;
	return 0;
}
0