結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
kongarishisyamo
|
| 提出日時 | 2016-02-28 04:36:25 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 436 bytes |
| コンパイル時間 | 570 ms |
| コンパイル使用メモリ | 55,452 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-24 11:59:49 |
| 合計ジャッジ時間 | 1,537 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
#include<iostream>
using namespace std;
#define NMAX 1000
int main(){
long long N;
long long a[NMAX],b[NMAX];
long long spacemax=-1;
long long ans=0;
cin>>N;
for(long long i=0;i<N;i++){
cin>>a[i]>>b[i];
if(a[i]+b[i]*4>spacemax) spacemax=a[i]+b[i]*4;
}
for(long long i=0;i<N;i++){
if((spacemax-(a[i]+b[i]*4))%2==1){
cout<<"-1"<<endl;
return 0;
}
else ans+=(spacemax-(a[i]+b[i]*4))/2;
}
cout<<ans<<endl;
}
kongarishisyamo