結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
hanorver
|
| 提出日時 | 2015-08-25 22:52:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 623 bytes |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 63,032 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-18 14:32:41 |
| 合計ジャッジ時間 | 1,111 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 14 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
int main() {
int n;
std::cin >> n;
std::vector<int> space(n, 0), tab(n, 0);
for (int i = 0; i < n; i++) {
std::cin >> space[i] >> tab[i];
}
std::vector<int> width(n, 0);
for (int i = 0; i < n; i++) {
width[i] = space[i] + 4 * tab[i];
}
for (int i = 0; i < n; i++) {
if (width[i] % 2 != width[0] % 2) {
std::cout << -1 << std::endl;
return 0;
}
}
int max = *std::max_element(width.begin(), width.end());
int count = 0;
for (int i = 0; i < n; i++) {
count += (max - width[i]);
}
std::cout << count / 2 << std::endl;
return 0;
}
hanorver