結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
|
提出日時 | 2015-04-06 22:46:49 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 834 bytes |
コンパイル時間 | 1,108 ms |
コンパイル使用メモリ | 92,004 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-04 03:28:23 |
合計ジャッジ時間 | 1,823 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> using namespace std; int main() { int n; cin >> n; vector<int> len(n); for(int i=0; i<n; ++i){ int a, b; cin >> a >> b; len[i] = a + 4 * b; } int maxLen = *max_element(len.begin(), len.end()); long long ans = 0; for(int i=0; i<n; ++i){ if((maxLen - len[i]) % 2 != 0){ ans = -1; break; } ans += (maxLen - len[i]) / 2; } cout << ans << endl; return 0; }