結果

問題 No.178 美しいWhitespace (1)
ユーザー koba-e964
提出日時 2015-05-04 21:30:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 54,488 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 18:59:53
合計ジャッジ時間 1,121 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

const int N = 1010;
int a[N], b[N];
using namespace std;
int w[N];

int main() {
int n;
cin >> n;
int wm =0;
for(int i = 0; i < n; ++i) {cin >> a[i] >>b[i]; w[i] = a[i]+4*b[i];wm=max(wm,w[i]);}
int cnt =0;
for(int i = 0;i<n;++i) {
if((wm-w[i])%2) {
cout <<-1<<endl;
return 0;
}
cnt+=(wm-w[i])/2;
}
cout<<cnt<<endl;

}
0