結果

問題 No.2451 Redistribute Integers
ユーザー ochiaigawa
提出日時 2023-09-01 21:34:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 197,700 KB
最終ジャッジ日時 2025-02-16 16:19:08
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0); cout.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<int> A(N);
  long long S = 0;
  set<int> st;
  for(int i = 0; i < N; i++) {
    cin >> A[i];
    S += A[i];
    st.insert((A[i] % N + N) % N);
  }
  cout << ((S % N == 0 && (int) st.size() == 1) ? "Yes\n" : "No\n");
  return 0;
}
0