結果

問題 No.2451 Redistribute Integers
ユーザー Narikiti0926Narikiti0926
提出日時 2023-09-03 00:22:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 528 ms / 2,000 ms
コード長 2,046 bytes
コンパイル時間 3,878 ms
コンパイル使用メモリ 232,672 KB
実行使用メモリ 30,460 KB
最終ジャッジ日時 2023-09-03 00:23:06
合計ジャッジ時間 8,414 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 252 ms
6,968 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 313 ms
30,460 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 124 ms
9,220 KB
testcase_13 AC 199 ms
7,024 KB
testcase_14 AC 216 ms
6,976 KB
testcase_15 AC 135 ms
4,924 KB
testcase_16 AC 180 ms
11,784 KB
testcase_17 AC 360 ms
16,604 KB
testcase_18 AC 201 ms
7,100 KB
testcase_19 AC 25 ms
4,552 KB
testcase_20 AC 416 ms
17,624 KB
testcase_21 AC 528 ms
21,388 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘void in(T& ...)’ 内:
main.cpp:37:55: 警告: 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: 関数 ‘void out(const T&, const Ts& ...)’ 内:
main.cpp:39:112: 警告: 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);
    set<ll> t;
    rep(i,n){
        t.insert(((a[i] % n)+n)%n);

    }
    if(t.size() == 1){
        out("Yes");
    }else{
        out("No");
    }
}
0