結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
greentea011
|
| 提出日時 | 2019-04-11 13:34:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 453 bytes |
| コンパイル時間 | 493 ms |
| コンパイル使用メモリ | 63,324 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-18 11:13:04 |
| 合計ジャッジ時間 | 1,360 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 7 WA * 14 |
ソースコード
#include <iostream>
int main(){
int n,a,b;
std::cin>>n;
int max=0;
int ans=0;
int t;
for (int i=0;i<n;i++){
std::cin>>a>>b;
t=a+4*b;
if (max&&(max-t)%2!=0) {
std::cout<<-1<<std::endl;
return 0;
}
if (max>t) {
ans+=(max-t)/2;
}
if (t>max) {
ans+=(t-max)/2*i;
max=t;
}
}
std::cout<<ans<<std::endl;
}
greentea011