結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
![]() |
提出日時 | 2015-10-25 00:45:45 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 452 bytes |
コンパイル時間 | 794 ms |
コンパイル使用メモリ | 63,224 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 08:28:00 |
合計ジャッジ時間 | 1,354 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long LL; int main(int argc, char *argv[]) { int N; cin >> N; vector<LL> v; for (int i = 0; i < N; ++i) { LL a, b; cin >> a >> b; v.push_back(a + 4 * b); } LL high = *max_element(v.begin(), v.end()); LL ans = 0; for (LL a : v) { LL d = high - a; if (d % 2) { ans = -1; break; } ans += d / 2; } cout << ans << endl; return 0; }