結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
kpinkcat
|
| 提出日時 | 2023-08-08 23:47:09 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 613 bytes |
| コンパイル時間 | 795 ms |
| コンパイル使用メモリ | 103,668 KB |
| 最終ジャッジ日時 | 2025-02-16 00:14:12 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
int main(){
long long n, max1 = -1, sum1 = 0, oe = -1;
cin >> n;
for (int i = 0; i < n; i++){
long long a, b, tmp;
cin >> a >> b;
if (i == 0) oe = a%2;
tmp = a + b*4;
if(a%2 != oe){
cout << -1 << endl;
return 0;
} else {
max1 = max(max1, tmp);
sum1 += tmp;
}
}
cout << (max1*n - sum1)/2 << endl;
}
kpinkcat