結果

問題 No.2451 Redistribute Integers
ユーザー tnakao0123tnakao0123
提出日時 2023-09-08 15:14:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 71 ms / 2,000 ms
コード長 631 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 40,516 KB
実行使用メモリ 4,920 KB
最終ジャッジ日時 2023-09-08 15:14:23
合計ジャッジ時間 3,354 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 71 ms
4,920 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 56 ms
4,900 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 31 ms
4,376 KB
testcase_13 AC 69 ms
4,800 KB
testcase_14 AC 71 ms
4,864 KB
testcase_15 AC 35 ms
4,376 KB
testcase_16 AC 32 ms
4,380 KB
testcase_17 AC 51 ms
4,380 KB
testcase_18 AC 68 ms
4,804 KB
testcase_19 AC 7 ms
4,380 KB
testcase_20 AC 54 ms
4,468 KB
testcase_21 AC 68 ms
4,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2451.cc:  No.2451 Redistribute Integers - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_N = 500000;

/* typedef */

typedef long long ll;

/* global variables */

int as[MAX_N];

/* subroutines */

inline int amod(int a, int n) {
  a %= n;
  if (a < 0) a += n;
  return a;
}

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i);

  int d0 = amod(as[0], n);
  for (int i = 1; i < n; i++)
    if (d0 != amod(as[i], n)) {
      puts("No");
      return 0;
    }

  puts("Yes");
  return 0;
}
0