結果
問題 |
No.3233 順列判定
|
ユーザー |
|
提出日時 | 2025-08-15 21:46:57 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 1,000 ms |
コード長 | 388 bytes |
コンパイル時間 | 2,929 ms |
コンパイル使用メモリ | 281,552 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-15 21:52:07 |
合計ジャッジ時間 | 4,558 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
ソースコード
#include<bits/stdc++.h> using namespace std; long modpow(long x,long k,long m){ assert(m>0); x%=m; long y=1%m; while(k){ if(k&1)y=y*x%m; x=x*x%m; k>>=1; } return y; } int main(){ long n,m; cin>>n>>m; vector<long>a(n); for(int i=0;i<n;i++)a[i]=modpow(i+1,m,n); sort(a.begin(),a.end()); a.erase(unique(a.begin(),a.end()),a.end()); cout<<(a.size()==n?"Yes":"No")<<'\n'; }