結果
| 問題 |
No.2451 Redistribute Integers
|
| コンテスト | |
| ユーザー |
tnakao0123
|
| 提出日時 | 2023-09-08 15:14:20 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 631 bytes |
| コンパイル時間 | 320 ms |
| コンパイル使用メモリ | 41,260 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 11:08:14 |
| 合計ジャッジ時間 | 2,081 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 |
ソースコード
/* -*- 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;
}
tnakao0123