結果
問題 | No.2451 Redistribute Integers |
ユーザー |
![]() |
提出日時 | 2023-06-20 22:02:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 275 ms / 2,000 ms |
コード長 | 563 bytes |
コンパイル時間 | 2,009 ms |
コンパイル使用メモリ | 199,488 KB |
最終ジャッジ日時 | 2025-02-14 23:37:02 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ll N, S=0; cin >> N; vector<ll> A(N), B(N); for (int i=0; i<N; i++){ cin >> A[i]; S += A[i]; } if (S % N != 0){ cout << "No" << endl; return 0; } S /= N; for (int i=0; i<N; i++) B[i] = A[i]-S; sort(B.begin(), B.end()); for (int i=0; i<N; i++){ if ((B[i]-B[0]) % N != 0){ cout << "No" << endl; return 0; } } cout << "Yes" << endl; return 0; }