結果
| 問題 |
No.3233 順列判定
|
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2025-08-17 00:28:44 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 16 ms / 1,000 ms |
| コード長 | 610 bytes |
| コンパイル時間 | 2,668 ms |
| コンパイル使用メモリ | 280,604 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-17 00:28:48 |
| 合計ジャッジ時間 | 4,608 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 40 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
inline int modpow(int a, int b, int m) {
int res = 1;
while (b) {
if (b & 1) res = (ll) res * a % m;
a = (ll) a * a % m;
b >>= 1;
}
return res;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m;
cin >> n >> m;
vector<int> a(n);
rep(i, n) a[i] = modpow(i + 1, m, n);
vector<bool> found(n, false);
rep(i, n) found[a[i]] = true;
cout << (ranges::all_of(found, identity()) ? "Yes" : "No") << '\n';
return 0;
}
a01sa01to