結果
問題 | No.2451 Redistribute Integers |
ユーザー |
|
提出日時 | 2023-09-01 22:24:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 204 ms / 2,000 ms |
コード長 | 577 bytes |
コンパイル時間 | 1,365 ms |
コンパイル使用メモリ | 168,540 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-11 11:03:45 |
合計ジャッジ時間 | 4,136 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> using ll = long long; using llu = long long unsigned; using namespace std; int main() { int N; cin >> N; vector<int> A(N); ll sum = 0; for (auto &x:A) { cin >> x; sum+=x; } string ret = "Yes"; if (sum%N) { ret = "No"; } else { int mod = A[0]%N; if (mod < 0) { mod+=N; } for (auto x : A) { int tmp_mod = x%N; if (tmp_mod < 0) { tmp_mod+=N; } if (mod != tmp_mod) { ret = "No"; break; } } } cout << ret << endl; return 0; }