Submission #52555359


Source Code Expand

Copy
def count_teeth(n, q, t):
holes = [1] * n
for i in range(q):
Ti = t[i]
if holes[Ti - 1] == 1:
holes[Ti - 1] = 0
else:
holes[Ti - 1] = 1
return sum(holes)
n, q = map(int, input().split())
t = list(map(int, input().split()))
print(count_teeth(n, q, t))
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
def count_teeth(n, q, t):
    holes = [1] * n

    for i in range(q):
        Ti = t[i]
        if holes[Ti - 1] == 1:
            holes[Ti - 1] = 0
        else:
            holes[Ti - 1] = 1

    return sum(holes)

n, q  = map(int, input().split())

t = list(map(int, input().split()))
print(count_teeth(n, q, t))

Submission Info

Submission Time
Task B - Dentist Aoki
User danianmercado
Language Python (PyPy 3.10-v7.3.12)
Score 200
Code Size 330 Byte
Status AC
Exec Time 57 ms
Memory 76608 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 20
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt
Case Name Status Exec Time Memory
sample_01.txt AC 56 ms 76592 KB
sample_02.txt AC 57 ms 76548 KB
sample_03.txt AC 56 ms 76384 KB
test_01.txt AC 56 ms 76256 KB
test_02.txt AC 56 ms 76600 KB
test_03.txt AC 57 ms 76468 KB
test_04.txt AC 56 ms 76240 KB
test_05.txt AC 56 ms 76468 KB
test_06.txt AC 56 ms 76388 KB
test_07.txt AC 56 ms 76392 KB
test_08.txt AC 56 ms 76220 KB
test_09.txt AC 57 ms 76584 KB
test_10.txt AC 56 ms 76296 KB
test_11.txt AC 56 ms 76176 KB
test_12.txt AC 56 ms 76172 KB
test_13.txt AC 57 ms 76568 KB
test_14.txt AC 56 ms 76272 KB
test_15.txt AC 57 ms 76596 KB
test_16.txt AC 56 ms 76440 KB
test_17.txt AC 56 ms 76608 KB


2025-03-17 (Mon)
21:59:55 +00:00