結果
問題 | No.2451 Redistribute Integers |
ユーザー |
![]() |
提出日時 | 2023-09-01 21:47:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 221 ms / 2,000 ms |
コード長 | 581 bytes |
コンパイル時間 | 1,912 ms |
コンパイル使用メモリ | 194,780 KB |
最終ジャッジ日時 | 2025-02-16 16:28:56 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> #define rep(i, a, n) for(int i = a; i < (n); i++) using namespace std; using ll = long long; using P = pair<ll, ll>; const int INF = 1001001001; const ll LINF = 1001002003004005006ll; //const int mod = 1000000007; //const int mod = 998244353; int main() { int n; cin >> n; vector<ll> a(n); rep(i, 0, n) cin >> a[i]; ll sum = accumulate(a.begin(), a.end(), 0ll); if (sum%n) { cout << "No\n"; return 0; } rep(i, 1, n) { if (abs(a[i] - a[i-1])%n) { cout << "No\n"; return 0; } } cout << "Yes\n"; return 0; }