結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-17 23:38:38 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 496 bytes |
| 記録 | |
| コンパイル時間 | 497 ms |
| コンパイル使用メモリ | 93,668 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-29 04:34:51 |
| 合計ジャッジ時間 | 1,412 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;cin>>n;
vector<int> z;
for(int i = 0; n > i; i++){
int a,b;cin>>a>>b;
z.push_back(a+b*4);
}
sort(z.begin(),z.end(),greater<int>());
long long ans = 0;
for(int i = 1; n > i; i++){
if((z[0]-z[i])%2==1){
cout << -1 << endl;
return 0;
}else{
ans += (z[0]-z[i])/2;
}
}
cout << ans << endl;
}