結果
| 問題 |
No.2451 Redistribute Integers
|
| コンテスト | |
| ユーザー |
hiro71687k
|
| 提出日時 | 2023-09-01 23:49:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 293 ms / 2,000 ms |
| コード長 | 717 bytes |
| コンパイル時間 | 4,067 ms |
| コンパイル使用メモリ | 252,916 KB |
| 最終ジャッジ日時 | 2025-02-16 17:40:46 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll mod=1000000007;
ll inf=1009999999999999990;
int main(){
ll n;
cin >> n;
vector<ll>a(n);
ll sum=0;
for (ll i = 0; i < n; i++)
{
cin >> a[i];
sum+=a[i];
}
if (sum%n==0)
{
sort(a.begin(),a.end());
for (ll i = 1; i < n; i++)
{
if ((a[i]%n+n)%n!=(a[i-1]%n+n)%n)
{
cout << "No" << endl;
return 0;
}
}
cout << "Yes" << endl;
}else{
cout << "No" <<endl;
}
}
hiro71687k