結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2017-07-29 11:18:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 495 bytes |
コンパイル時間 | 690 ms |
コンパイル使用メモリ | 68,620 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-10 21:31:49 |
合計ジャッジ時間 | 1,447 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 5 WA * 16 |
ソースコード
#include <iostream> #include <vector> #include <string> #include <algorithm> #include <math.h> using namespace std; int main() { int n; cin >> n; vector<int> l(n,0); for(int i = 0;i < n;i++){ int a,b; cin >> a >> b; l[i] = a + 4*b; } sort(l.begin(),l.end(),greater<int>()); int ans = 0; for(int i = 0;i < n;i++){ ans += l[0] - l[i]; } if(ans % 2 == 0)cout << ans / 2 << endl; else cout << -1 << endl; return 0; }