結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
![]() |
提出日時 | 2015-06-10 22:56:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 552 bytes |
コンパイル時間 | 476 ms |
コンパイル使用メモリ | 61,276 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 15:27:35 |
合計ジャッジ時間 | 1,114 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long LL; int main(){ int N; LL m_len = 0; cin >> N; vector<LL> len(N); for(int i = 0; i < N; i++){ LL a, b; cin >> a >> b; m_len = max(m_len, a + b*4); len[i] = a + b*4; } LL ans = 0; for(int i = 0; i < N; i++){ LL diff = m_len - len[i]; if(diff % 2 == 1){ ans = -1; break; } ans += diff/2; } cout << ans << endl; return 0; }