結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
zaichu
|
| 提出日時 | 2015-12-19 20:27:26 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 532 bytes |
| 記録 | |
| コンパイル時間 | 1,473 ms |
| コンパイル使用メモリ | 90,880 KB |
| 実行使用メモリ | 7,976 KB |
| 最終ジャッジ日時 | 2026-04-06 06:17:23 |
| 合計ジャッジ時間 | 1,449 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 14 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <array>
#include <algorithm>
#include <set>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> total;
int a,b;
for(int i = 0; i < n; i++){
cin >> a >> b;
int x = a + 4 * b;
total.push_back(x);
}
sort(total.begin(),total.end(),greater<int>());
int max = total[0];
int sum = 0;
for(int i = 1; i < n; i++){
if((max - total[i]) % 2){
cout << -1 << endl;
return 0;
}
sum += max-total[i];
}
cout << sum / 2 << endl;
return 0;
}
zaichu