結果
問題 |
No.2451 Redistribute Integers
|
ユーザー |
![]() |
提出日時 | 2023-09-01 21:35:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 495 bytes |
コンパイル時間 | 1,953 ms |
コンパイル使用メモリ | 194,108 KB |
最終ジャッジ日時 | 2025-02-16 16:19:28 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 6 |
ソースコード
#include <bits/stdc++.h> #define endl '\n' typedef long long ll; using namespace std; int main(void) { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } ll tot = accumulate(a.begin(), a.end(), 0LL); string ans = "No"; if (tot % n == 0) { ll m = tot / n; ll diff = 0; for (int i = 0; i < n; i++) { diff += a[i] - m; } if (diff % (n - 1) == 0) ans = "Yes"; } cout << ans << endl; return 0; }