結果
問題 | No.1043 直列大学 |
ユーザー |
![]() |
提出日時 | 2020-05-01 22:40:44 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 962 ms / 2,000 ms |
コード長 | 1,201 bytes |
コンパイル時間 | 382 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 181,124 KB |
最終ジャッジ日時 | 2024-12-22 19:37:33 |
合計ジャッジ時間 | 14,380 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
import sysinput = sys.stdin.readlinefrom collections import Counterfrom itertools import accumulateN,M=map(int,input().split())V=list(map(int,input().split()))R=list(map(int,input().split()))A,B=map(int,input().split())mod=1000000007C=Counter()C[0]=1for v in V:NC=Counter()for c in C:NC[c]=(NC[c]+C[c])%modNC[c+v]=(NC[c+v]+C[c])%modC=NCC2=Counter()C2[0]=1for r in R:NC2=Counter()for c2 in C2:NC2[c2]=(NC2[c2]+C2[c2])%modNC2[c2+r]=(NC2[c2+r]+C2[c2])%modC2=NC2del(C[0])del(C2[0])COUNT0=[0]*(10**5+1)COUNT1=[0]*(10**5+1)for c in C:COUNT0[c]=C[c]for c2 in C2:COUNT1[c2]=C2[c2]S1=list(accumulate(COUNT1))ANS=0r=0for v in range(1,10**5+1):while r*B<v and r<=10**5:r+=1#print(v,r,ANS)if 0<=r-1<=10**5:ANS+=COUNT0[v]*(S1[-1]-S1[r-1])elif r==10**5+1:ANS+=COUNT0[v]*(S1[-1]-S1[10**5])#print(ANS)r=0for v in range(1,10**5+1):while r*A<=v and r>=0:r+=1#print(v,r)if r<=10**5:ANS-=COUNT0[v]*(S1[-1]-S1[r-1])elif r==10**5+1:ANS-=COUNT0[v]*(S1[-1]-S1[10**5])print(ANS%mod)