結果
| 問題 |
No.2451 Redistribute Integers
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-09-03 00:22:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 374 ms / 2,000 ms |
| コード長 | 2,046 bytes |
| コンパイル時間 | 3,710 ms |
| コンパイル使用メモリ | 233,188 KB |
| 実行使用メモリ | 30,720 KB |
| 最終ジャッジ日時 | 2024-06-11 11:07:32 |
| 合計ジャッジ時間 | 7,018 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
コンパイルメッセージ
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'; }
| ^
ソースコード
#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");
}
}