結果

問題 No.1586 Equal Array
ユーザー もひもひーともひもひーと
提出日時 2022-05-27 16:10:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 45 ms / 1,000 ms
コード長 2,268 bytes
コンパイル時間 1,518 ms
コンパイル使用メモリ 168,032 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 19:43:36
合計ジャッジ時間 3,803 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 20 ms
4,348 KB
testcase_05 AC 20 ms
4,348 KB
testcase_06 AC 42 ms
4,348 KB
testcase_07 AC 41 ms
4,348 KB
testcase_08 AC 41 ms
4,348 KB
testcase_09 AC 41 ms
4,348 KB
testcase_10 AC 41 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 41 ms
4,348 KB
testcase_14 AC 41 ms
4,348 KB
testcase_15 AC 41 ms
4,348 KB
testcase_16 AC 41 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 41 ms
4,348 KB
testcase_19 AC 45 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cmath>
#include<set>
#include<stack>
#include<deque>
#include<cassert>
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
typedef pair<int,int> P;
using Graph = vector<vector<int>>;
//#define INF 10000000
/*
const int MAX_N = 1<<17;

int n,dat[2 * MAX_N - 1];

void init(int n_){
    n = 1;
    while(n < n_) n *= 2;
    cout << n << endl;
    for(int i=0; i<2 * n-1; i++) dat[i] = INT_MAX;
}

void update(int k,int a){
    k += n-1;
    dat[k] = a;

    while(k > 0){
        k = (k-1)/2;
        dat[k] = min(dat[k*2+1],dat[k*2+2]);
    }
}

int query(int a,int b,int k,int l,int r){
    if(r <= a || b <= l) return INT_MAX;

    if(a <= l && r <= b) return dat[k];
    else {
        int v1 = query(a,b,k*2+1,l,(l+r)/2);
        int v2 = query(a,b,k*2+2,(l+r)/2,r);
        return min(v1,v2);
    }
}
*/

class UnionFind{
    public:
    vector<int> par;

    UnionFind(int n) : par(n){
        for(int i=0; i<n; i++) par[i] = -1;
    }

    int root(int x){
        if(par[x] == -1) return x;
        int next = par[x];
        return root(next);
    }

    void unite(int x, int y){
        int px = root(x);
        int py = root(y);
        if(px == py) return;
        par[px] = py;
    }

    bool same(int x, int y){
        int px = root(x);
        int py = root(y);
        if(px == py) return true;
        else return false; 
    }
};



bool isPrime(int x){
    bool prime = true;
    for(int i=2; i<x; i++){
        if(x%i == 0){
            prime = false;
            break;
        }
    }
    if(!prime) return false;
    return true;
}


//------------------------------------------------------------------------//

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    rep(i,n){
        cin >> a[i];
        sum += a[i];
    }
    if(sum % n == 0){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}
0