結果
問題 |
No.3233 順列判定
|
ユーザー |
![]() |
提出日時 | 2025-08-15 22:52:23 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 595 ms |
コンパイル使用メモリ | 92,344 KB |
実行使用メモリ | 8,204 KB |
最終ジャッジ日時 | 2025-08-15 22:52:29 |
合計ジャッジ時間 | 3,412 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 40 |
ソースコード
import std.stdio, std.algorithm, std.array, std.conv, std.typecons, std.range; void main() { auto tmp = readln.split.to!(uint[]); auto N = tmp[0], M = tmp[1]; bool[uint] Aset; foreach (i; 1 .. N+1) { Aset[pow_mod(i, M, N)] = true; } writeln(Aset.keys.sort.equal(iota(N))); //writeln(Aset.length == N ? "Yes" : "No"); } // (i ^^ p) % n for i > 0 uint pow_mod(uint i, uint p, uint n) { uint result = 1; foreach (_; 0 .. p) { result = (result * i) % n; } return result; }