結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
woodsgreen
|
| 提出日時 | 2023-01-09 10:23:32 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 391 bytes |
| コンパイル時間 | 1,708 ms |
| コンパイル使用メモリ | 193,288 KB |
| 最終ジャッジ日時 | 2025-02-10 01:20:34 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int n,a[1010],maxn;
long long ans;
int main(){
cin>>n;
for(int i=0,x,y;i<n;++i){
cin>>x>>y;
a[i]=x+4*y;
maxn=max(maxn,a[i]);
}
for(int i=0;i<n;++i){
if(maxn%2!=a[i]%2){
cout<<-1<<endl;
return 0;
}
ans+=maxn-a[i];
}
cout<<ans/2<<endl;
return 0;
}
woodsgreen