結果
問題 | No.2942 Sigma Music Game Level Problem |
ユーザー |
![]() |
提出日時 | 2024-10-18 22:43:29 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 4,039 ms / 6,000 ms |
コード長 | 732 bytes |
コンパイル時間 | 448 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 243,080 KB |
最終ジャッジ日時 | 2024-11-15 18:47:02 |
合計ジャッジ時間 | 32,913 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
N,Q,L0=map(int,input().split()) A=list(map(int,input().split())) B=448 st11=[0]*B*B st12=[0]*B st21=[0]*B*B st22=[0]*B for l in A: st11[l]+=1 st12[l//B]+=1 st21[l]+=l st22[l//B]+=l q2f=0 for _ in range(Q): t,*p,=list(map(int,input().split())) if t==1: l=p[0] st11[l]+=1 st12[l//B]+=1 st21[l]+=l st22[l//B]+=l if t==2: q2f=1 l=p[0] r=p[1] yl=l//B yr=r//B a1=0 a2=0 if yl==yr: a1+=sum(st11[l:r+1]) a2+=sum(st21[l:r+1]) else: a1+=sum(st11[l:yl*B+B]) a1+=sum(st12[yl+1:yr]) a1+=sum(st11[yr*B:r+1]) a2+=sum(st21[l:yl*B+B]) a2+=sum(st22[yl+1:yr]) a2+=sum(st21[yr*B:r+1]) print(a1,a2) if q2f==0: print("Not Found!")