結果

問題 No.2451 Redistribute Integers
ユーザー hiro71687khiro71687k
提出日時 2023-09-01 23:47:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 702 bytes
コンパイル時間 4,119 ms
コンパイル使用メモリ 262,176 KB
実行使用メモリ 7,116 KB
最終ジャッジ日時 2023-09-01 23:47:08
合計ジャッジ時間 7,572 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 142 ms
7,116 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 75 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 86 ms
4,960 KB
testcase_17 AC 168 ms
6,104 KB
testcase_18 WA -
testcase_19 AC 18 ms
4,376 KB
testcase_20 AC 146 ms
6,036 KB
testcase_21 AC 229 ms
7,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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]-a[i-1]<n)
            {
                cout << "No" << endl;
                return 0;
            }
            
        }
        
        cout << "Yes" << endl;
    }else{
        cout << "No" <<endl;
    }
    
}
0