結果

問題 No.2451 Redistribute Integers
ユーザー KumaTachiRenKumaTachiRen
提出日時 2023-09-01 21:41:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 925 bytes
コンパイル時間 4,089 ms
コンパイル使用メモリ 258,440 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-01 21:41:55
合計ジャッジ時間 6,013 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 70 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 53 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 24 ms
4,380 KB
testcase_13 AC 65 ms
4,376 KB
testcase_14 AC 69 ms
4,376 KB
testcase_15 AC 36 ms
4,376 KB
testcase_16 AC 33 ms
4,376 KB
testcase_17 AC 52 ms
4,376 KB
testcase_18 AC 64 ms
4,380 KB
testcase_19 AC 7 ms
4,380 KB
testcase_20 AC 55 ms
4,376 KB
testcase_21 AC 69 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

struct Fast {
  Fast() {
    std::cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(10);
  }
} fast;

#define all(a) (a).begin(), (a).end()
#define contains(a, x) ((a).find(x) != (a).end())
#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (a); i--)
#define writejoin(s, a) rep(_i, 0, (a).size()) cout << (a)[_i] << (_i + 1 < (int)(a).size() ? s : "\n");
#define YN(b) cout << ((b) ? "YES" : "NO") << "\n";
#define Yn(b) cout << ((b) ? "Yes" : "No") << "\n";
#define yn(b) cout << ((b) ? "yes" : "no") << "\n";

using ll = long long;

int main() {
  int n;
  cin >> n;
  bool ans = true;
  ll prv = -1;
  rep(i, 0, n) {
    ll a;
    cin >> a;
    a %= n;
    if (a < 0) a += n;
    if (prv > -1) ans &= a == prv;
    prv = a;
  }
  Yn(ans);
}
0