結果

問題 No.3233 順列判定
ユーザー The Forsaking
提出日時 2025-08-16 12:33:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 529 bytes
コンパイル時間 1,628 ms
コンパイル使用メモリ 199,948 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2025-08-16 12:33:45
合計ジャッジ時間 3,618 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
const int N = 2000086, MOD =  998244353, INF = 0x3f3f3f3f;
ll res;
int n, m, cnt, w[N];




inline ll qmi(ll a, ll b, ll c) { ll res = 1; while (b) { if (b & 1) res = res * a % c; a = a * a % c; b >>= 1; } return res; }
int main() {
    cin >> n >> m;
    set<int> st;
    for (int i = 1; i < n + 1; i++) st.insert(qmi(i, m, n));
    puts(st.size() == n && *st.begin() == 0 && *st.rbegin() == n - 1 ? "YES" : "NO");
    return 0;
}
0