結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
![]() |
提出日時 | 2017-09-22 21:53:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 575 bytes |
コンパイル時間 | 856 ms |
コンパイル使用メモリ | 71,424 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-08 14:36:47 |
合計ジャッジ時間 | 1,640 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <iostream> #include <iomanip> #include <vector> typedef long long ll; int main(void) { std::cin.tie(0); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(8); int n; std::cin >> n; ll w_max = 0, w_sum = 0; for (int i = 0; i < n; ++i) { ll a, b; std::cin >> a >> b; ll w_now = a + 4*b; if (i != 0 && w_now%2 != w_max%2) {std::cout << -1 << std::endl; return 0;} w_max = std::max(w_max, w_now); w_sum += w_now; } ll w_diff = w_max * n - w_sum; std::cout << w_diff/2 << std::endl; return 0; }