結果

問題 No.2451 Redistribute Integers
ユーザー Narikiti0926Narikiti0926
提出日時 2023-09-01 22:16:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,032 bytes
コンパイル時間 3,724 ms
コンパイル使用メモリ 229,064 KB
実行使用メモリ 7,296 KB
最終ジャッジ日時 2024-06-11 11:03:37
合計ジャッジ時間 6,310 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 214 ms
7,296 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 153 ms
7,296 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
testcase_13 AC 176 ms
7,168 KB
testcase_14 AC 199 ms
7,168 KB
testcase_15 AC 105 ms
5,376 KB
testcase_16 AC 88 ms
5,376 KB
testcase_17 WA -
testcase_18 AC 180 ms
7,296 KB
testcase_19 WA -
testcase_20 AC 146 ms
6,272 KB
testcase_21 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void in(T& ...)':
main.cpp:37:55: warning: fold-expressions only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   37 | template<class... T> void in(T&... a){ (cin >> ... >> a); }
      |                                                       ^
main.cpp: In function 'void out(const T&, const Ts& ...)':
main.cpp:39:112: warning: fold-expressions only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   39 | template<class T, class... Ts> void out(const T& a, const Ts&... b){ cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; }
      |                                                                                                                ^

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(n) for(int i = 0; i < (int)(n); ++i)
#define rep2(i, n) for(int i = 0; i < (int)(n); ++i)
#define rep3(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep4(i, a, b, c) for(int i = (a); i < (int)(b); i += (c))
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)

#define Sort(a) sort(a.begin(), a.end())
#define RSort(a) sort(a.rbegin(), a.rend())
 
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;

typedef vector<int> vi;
typedef vector<char> vcr;
typedef vector<long long> vll;
typedef vector<long double> vld;
typedef vector<string> vst;

const ll INF = 0x1fffffffffffffff;
const ll MOD = 998244353;

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; }

template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p){ is >> p.first >> p.second; return is; }
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for(T &in : v) is >> in; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v){ for(int i = 0; i < (int) v.size(); ++i){ os << v[i] << (i + 1 != (int) v.size() ? " " : ""); } return os; }

template<class... T> void in(T&... a){ (cin >> ... >> a); }
void out(){ cout << '\n'; }
template<class T, class... Ts> void out(const T& a, const Ts&... b){ cout << a; (cout << ... << (cout << ' ', b)); cout << '\n'; }

// 素数を判定する関数
bool isprime(int N) {
    if (N < 2) return false;
    for (int i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}

int main() {
    ll n;
    in(n);
    vll a(n);
    in(a);
    ll sum = 0;
    rep(i,n){
        sum += a[i];
    }
    if(sum % n == 0){
        out("Yes");
    }else{
        out("No");
    }
}

0