結果
| 問題 |
No.3233 順列判定
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-15 21:27:08 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 59 ms / 1,000 ms |
| コード長 | 1,113 bytes |
| コンパイル時間 | 2,999 ms |
| コンパイル使用メモリ | 280,612 KB |
| 実行使用メモリ | 8,192 KB |
| 最終ジャッジ日時 | 2025-08-15 21:27:18 |
| 合計ジャッジ時間 | 4,890 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 40 |
ソースコード
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template<typename T> using pq = priority_queue<T,vector<T>,greater<T>>;
using P = pair<int,int>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}
// (a^n) % mod を求める O(log(n))
ll modpow(ll a, ll n, ll mod) {
ll res = 1;
a %= mod;
while (n > 0) {
if (n & 1) res = res * a % mod;
a = a * a % mod;
n >>= 1;
}
return res;
}
int main() {
int n, m;
cin >> n >> m;
set<int> st;
rep(i,1,n+1) {
st.emplace(modpow(i, m, n));
}
if (len(st) == n) {
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
return 0;
}