結果
| 問題 |
No.3233 順列判定
|
| コンテスト | |
| ユーザー |
eve__fuyuki
|
| 提出日時 | 2025-08-21 23:23:05 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 1,000 ms |
| コード長 | 603 bytes |
| コンパイル時間 | 1,833 ms |
| コンパイル使用メモリ | 200,992 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-21 23:23:09 |
| 合計ジャッジ時間 | 3,438 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 40 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
void fast_io() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
}
long long pow_mod(long long base, int exp, long long mod) {
long long res = 1;
while (exp > 0) {
if (exp % 2 == 1) {
res = (res * base) % mod;
}
base = (base * base) % mod;
exp /= 2;
}
return res;
}
int main() {
fast_io();
int n, m;
cin >> n >> m;
vector<long long> a;
for (int i = 1; i <= n; i++) {
a.push_back(pow_mod(i, m, n));
}
sort(a.begin(), a.end());
a.erase(unique(a.begin(), a.end()), a.end());
cout << (a.size() == n ? "Yes" : "No") << endl;
}
eve__fuyuki