Submission #5671812
Source Code Expand
from collections import defaultdict, Counter N, M = map(int, input().split()) x = list(map(int, input().split())) x.sort() c = Counter(x) a = defaultdict(int) E = defaultdict(int) for i,j in c.items(): a[i%M] += j E[i%M] += j//2 ans = 0 for i in range(0, M): j = M - i if i < j: m = min(a[i], a[j]) t = min((a[i] - m)//2, E[i]) + min((a[j] - m)//2, E[j]) ans += m+t elif i == 0 or (M//2 == i and M%2 ==0): ans += a[i] //2 else: break print(ans)
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | siiiii1107 |
Language | PyPy3 (2.4.0) |
Score | 0 |
Code Size | 537 Byte |
Status | WA |
Exec Time | 311 ms |
Memory | 82024 KB |
Judge Result
Set Name | sample | all | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
all | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, sample-01.txt, sample-02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | WA | 165 ms | 38384 KB |
01-02.txt | WA | 232 ms | 55408 KB |
01-03.txt | WA | 234 ms | 55536 KB |
01-04.txt | WA | 234 ms | 55408 KB |
01-05.txt | WA | 234 ms | 55536 KB |
01-06.txt | WA | 233 ms | 55532 KB |
01-07.txt | WA | 234 ms | 55532 KB |
01-08.txt | WA | 237 ms | 55532 KB |
01-09.txt | WA | 247 ms | 55532 KB |
01-10.txt | AC | 302 ms | 66796 KB |
01-11.txt | AC | 311 ms | 79596 KB |
01-12.txt | AC | 207 ms | 52804 KB |
01-13.txt | AC | 248 ms | 59972 KB |
01-14.txt | WA | 238 ms | 61676 KB |
01-15.txt | WA | 236 ms | 61676 KB |
01-16.txt | WA | 235 ms | 61676 KB |
01-17.txt | WA | 239 ms | 61804 KB |
01-18.txt | WA | 259 ms | 61548 KB |
01-19.txt | WA | 262 ms | 62056 KB |
01-20.txt | AC | 266 ms | 82024 KB |
01-21.txt | WA | 224 ms | 52332 KB |
01-22.txt | WA | 223 ms | 52336 KB |
01-23.txt | WA | 227 ms | 52336 KB |
01-24.txt | AC | 234 ms | 52464 KB |
01-25.txt | AC | 267 ms | 60912 KB |
01-26.txt | AC | 272 ms | 73196 KB |
01-27.txt | AC | 241 ms | 70548 KB |
01-28.txt | AC | 225 ms | 62700 KB |
01-29.txt | AC | 218 ms | 49388 KB |
01-30.txt | AC | 196 ms | 59884 KB |
sample-01.txt | AC | 165 ms | 38256 KB |
sample-02.txt | WA | 165 ms | 38256 KB |