結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2016-10-06 22:29:32 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 595 bytes |
コンパイル時間 | 552 ms |
コンパイル使用メモリ | 74,892 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-21 18:59:18 |
合計ジャッジ時間 | 1,331 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include<iostream> #include<algorithm> #include<cstdio> #include<cstdlib> #include<vector> #include<map> #include<queue> #include<string> #include<sstream> #include<cmath> using namespace std; int main(){ int n; cin >> n; int a, b; vector<long long int> w(n); for(int i=0; i<n; i++){ cin >> a >> b; w[i] = a + 4 * b; } int mx = *max_element(w.begin(), w.end()); int f = w[0]%2; long long int cnt = 0; for(int i=0; i<n; i++){ if( w[i]%2 != f ){ cout << -1 << endl; return 0; } cnt += (mx - w[i])/2; } cout << cnt << endl; return 0; }