結果

問題 No.178 美しいWhitespace (1)
ユーザー KKT89
提出日時 2020-06-20 10:54:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 683 bytes
コンパイル時間 1,050 ms
コンパイル使用メモリ 107,256 KB
最終ジャッジ日時 2025-01-11 08:34:31
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <deque>
#include <queue>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    set<int>s;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        int x,y; cin >> x >> y;
        a[i]=x+4*y;
        s.insert(a[i]%2);
    }
    if(s.size()==2){
        printf("-1\n");
    }
    else{
        sort(a.rbegin(), a.rend());
        ll res=0;
        for(int i=0;i<n;i++){
            res+=(a[0]-a[i])/2;
        }
        cout << res << endl;
    }
}
0