結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-06-27 18:48:57 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 412 bytes |
| 記録 | |
| コンパイル時間 | 1,169 ms |
| コンパイル使用メモリ | 182,492 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-27 04:37:55 |
| 合計ジャッジ時間 | 1,880 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
int main(){
int n; cin>>n;
int a,b; int mx=0;
vector<int> v;
rep(i,n){
cin>>a>>b;
mx=max(mx,(a+b*4));
v.push_back(a+b*4);
}
// for(auto x:v) cout<<x<<endl;
ll ans=0;
for(int i=0; i<n; i++){
if((mx-v[i])%2!=0) {cout<<"-1"<<endl; return 0;}
ans+=(mx-v[i]);
}
cout<<ans/2<<endl;
}