結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
![]() |
提出日時 | 2019-07-19 04:38:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 2,102 ms |
コンパイル使用メモリ | 168,716 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-25 23:55:56 |
合計ジャッジ時間 | 2,492 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> vt(n); for (int i = 0; i < n; ++i) { long long a, b; cin >> a >> b; vt[i] = a + 4 * b; } long long wsMax = *std::max_element(vt.begin(), vt.end()); long long ans = 0; for (int i = 0; i < n; ++i) { if ((wsMax - vt[i]) % 2 != 0) { cout << -1 << endl; return 0; } else { ans += (wsMax - vt[i]) / 2; } } cout << ans << endl; return 0; }