結果

問題 No.2755 行列の共役類
ユーザー Shirotsume
提出日時 2023-08-07 21:12:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,099 ms / 3,500 ms
コード長 1,043 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 82,140 KB
実行使用メモリ 79,556 KB
最終ジャッジ日時 2024-11-08 02:37:45
合計ジャッジ時間 23,394 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 66
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, time, random
from collections import deque, Counter, defaultdict
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

B, C = map(int,input().split())
P = []
b = B
e = 1
for i in range(2,B):
    if i*i>b:break
    while b % i == 0:
        b //= i
        P.append(i)
        e *= (i - 1)
        while b % i == 0:
            b //= i
            e *= i
if b>1:
    P.append(b)
    e *= (b - 1)
n = len(P)
u = [pow(i,e-1,B)for i in range(B)]
d = B // C
b = d * B
found = [0] * b
answer = 0
for i in range(b):
    if found[i]:continue
    q = i // d
    r = i % d
    c = 1
    for p in P:
        c *= q % p
    if c == 0:
        continue
    answer +=1
    if answer >100:
        print("100+")
        exit()
    for j in range(b):
        s = j // d
        t = j % d
        c = 1
        for p in P:
            c *=s % p
        found[(u[s] * q * s % B) * d + (u[s] * (q * t + r - t)) % d] |= c
print(answer)
0