Submission #65004667


Source Code Expand

Copy
def li():
return list(map(int, input().split()))
n,m=li()
a=[li() for _ in range(m)]
b=li()
date={}
for i in range(n):
date[b[i]]=i
ans=[0]*n
for i in range(m):
k=a[i][0]
A=a[i][1:]
tmp=0
for i in range(k):
tmp=max(tmp,date[A[i]])
ans[tmp]+=1
from itertools import accumulate
ans=list(accumulate(ans))
print(*ans,sep="\n")
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
def li():
    return list(map(int, input().split()))


n,m=li()
a=[li() for _ in range(m)]
b=li()
date={}
for i in range(n):
    date[b[i]]=i
ans=[0]*n
for i in range(m):
    k=a[i][0]
    A=a[i][1:]
    tmp=0
    for i in range(k):
        tmp=max(tmp,date[A[i]])
    ans[tmp]+=1
from itertools import accumulate
ans=list(accumulate(ans))
print(*ans,sep="\n")

Submission Info

Submission Time
Task C - Dislike Foods
User juntenbanana
Language Python (CPython 3.11.4)
Score 300
Code Size 380 Byte
Status AC
Exec Time 841 ms
Memory 110948 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 33
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 9 ms 8904 KB
00_sample_01.txt AC 10 ms 8932 KB
01_test_00.txt AC 115 ms 18672 KB
01_test_01.txt AC 51 ms 12828 KB
01_test_02.txt AC 32 ms 9932 KB
01_test_03.txt AC 17 ms 9772 KB
01_test_04.txt AC 34 ms 11688 KB
01_test_05.txt AC 18 ms 9892 KB
01_test_06.txt AC 312 ms 71200 KB
01_test_07.txt AC 244 ms 28628 KB
01_test_08.txt AC 283 ms 71960 KB
01_test_09.txt AC 283 ms 63444 KB
01_test_10.txt AC 250 ms 66856 KB
01_test_11.txt AC 469 ms 80136 KB
01_test_12.txt AC 383 ms 78768 KB
01_test_13.txt AC 188 ms 28180 KB
01_test_14.txt AC 340 ms 75300 KB
01_test_15.txt AC 219 ms 33876 KB
01_test_16.txt AC 747 ms 105624 KB
01_test_17.txt AC 346 ms 37620 KB
01_test_18.txt AC 496 ms 81880 KB
01_test_19.txt AC 580 ms 73592 KB
01_test_20.txt AC 761 ms 101644 KB
01_test_21.txt AC 841 ms 110868 KB
01_test_22.txt AC 836 ms 110948 KB
01_test_23.txt AC 806 ms 110820 KB
01_test_24.txt AC 166 ms 14752 KB
01_test_25.txt AC 112 ms 21448 KB
01_test_26.txt AC 323 ms 28856 KB
01_test_27.txt AC 261 ms 22372 KB
01_test_28.txt AC 110 ms 15636 KB
01_test_29.txt AC 322 ms 28712 KB
01_test_30.txt AC 10 ms 8920 KB


2025-04-26 (Sat)
20:48:29 +09:00