結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
|
提出日時 | 2017-11-12 12:00:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 563 bytes |
コンパイル時間 | 1,499 ms |
コンパイル使用メモリ | 166,324 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-24 23:11:46 |
合計ジャッジ時間 | 2,464 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include<bits/stdc++.h> #define rep(i,a,n) for (int i = a;i < n;i++) using namespace std; int main(){ int n; cin >> n; int lmax = 0; int lmin = 99999999; long long lsum = 0; rep(i,0,n){ int a,b; cin >> a >> b; int len = a + b * 4; if(i != 0){ if(lmax % 2 != len % 2){ cout << -1 << endl; return 0; } } lmax = max(len, lmax); lmin = min(len, lmin); lsum += len; } cout << ((long long)lmax * n -lsum ) / 2 << endl; }