結果

問題 No.896 友達以上恋人未満
ユーザー vwxyzvwxyz
提出日時 2024-04-15 13:24:01
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 878 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 81,968 KB
実行使用メモリ 338,320 KB
最終ジャッジ日時 2024-04-15 13:24:11
合計ジャッジ時間 9,352 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,848 KB
testcase_01 AC 40 ms
52,148 KB
testcase_02 AC 42 ms
52,876 KB
testcase_03 AC 42 ms
53,132 KB
testcase_04 AC 47 ms
60,644 KB
testcase_05 AC 777 ms
141,656 KB
testcase_06 AC 1,305 ms
141,496 KB
testcase_07 AC 781 ms
141,792 KB
testcase_08 AC 811 ms
142,072 KB
testcase_09 MLE -
testcase_10 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

M,N,mulX,addX,mulY,addY,mod=map(int,input().split())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
cnt=[0]*mod
for x,y in zip(X,Y):
    cnt[x]+=y
for i in range(M,N):
    x = (x * mulX + addX)&(mod-1)
    y = (y * mulY + addY)&(mod-1)
    cnt[x]+=y
is_prime=[True]*mod
for p in range(2,mod):
    if is_prime[p]:
        for x in range((mod-1)//p,0,-1):
            cnt[x]+=cnt[x*p]
        for i in range(2*p,mod,p):
            is_prime[i]=False
ans=0
for a,b in zip(A,B):
    c=0
    if a<mod:
        c+=cnt[a]
    if a*b<mod:
        c-=cnt[a*b]
    print(c)
    ans^=c
for i in range(M,N):
    a = ((a * mulX + addX + mod - 1)&(mod-1)) + 1
    b = ((b * mulY + addY + mod - 1)&(mod-1)) + 1
    c=0
    if a<mod:
        c+=cnt[a]
    if a*b<mod:
        c-=cnt[a*b]
    ans^=c
print(ans)
0