結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2021-03-18 14:59:54 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 414 bytes |
コンパイル時間 | 1,582 ms |
コンパイル使用メモリ | 165,580 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 17:15:50 |
合計ジャッジ時間 | 2,379 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int N; long initial; long a,b; long M=0; long s=0; cin>>N; for(int i=0;i<N;i++){ cin>>a>>b; if(i==0){ initial=(a+b*4); } M=max(M,a+b*4); s+=a+b*4; if((a+b*4)%2!=initial%2){ cout<<-1<<endl; return 0; } } cout<<(M*N-s)/2<<endl; }