結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2019-04-11 13:35:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 451 bytes |
コンパイル時間 | 529 ms |
コンパイル使用メモリ | 63,452 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-18 11:13:39 |
合計ジャッジ時間 | 1,304 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
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 (i&&(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; }