結果

問題 No.2451 Redistribute Integers
ユーザー futamegawafutamegawa
提出日時 2023-09-01 22:24:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 210 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 1,512 ms
コンパイル使用メモリ 166,724 KB
実行使用メモリ 5,020 KB
最終ジャッジ日時 2023-09-01 22:24:59
合計ジャッジ時間 4,609 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 210 ms
5,020 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 144 ms
4,864 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 64 ms
4,376 KB
testcase_13 AC 181 ms
4,952 KB
testcase_14 AC 197 ms
4,860 KB
testcase_15 AC 100 ms
4,380 KB
testcase_16 AC 87 ms
4,376 KB
testcase_17 AC 140 ms
4,376 KB
testcase_18 AC 183 ms
5,008 KB
testcase_19 AC 16 ms
4,380 KB
testcase_20 AC 149 ms
4,568 KB
testcase_21 AC 185 ms
4,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using ll = long long;
using llu = long long unsigned;

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    ll sum = 0;
    for (auto &x:A) {
        cin >> x;
        sum+=x;
    }

    string ret = "Yes";
    if (sum%N) { ret = "No"; }
    else {
        int mod = A[0]%N;
        if (mod < 0) { mod+=N; }
        for (auto x : A) {
            int tmp_mod = x%N;
            if (tmp_mod < 0) { tmp_mod+=N; }
            if (mod != tmp_mod) { ret = "No"; break; }
        }
    }
    cout << ret << endl; return 0;
}
0