Submission #5671877
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 = a[0]//2 for i in range(0, M): j = M - i if i == 0 or i == j: #i==0は最初のifにかかってしまうため注意 ans += a[i] //2 elif 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 print(ans)
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | siiiii1107 |
Language | PyPy3 (2.4.0) |
Score | 0 |
Code Size | 561 Byte |
Status | WA |
Exec Time | 308 ms |
Memory | 82152 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 | 166 ms | 38384 KB |
01-02.txt | WA | 232 ms | 55408 KB |
01-03.txt | WA | 236 ms | 55408 KB |
01-04.txt | WA | 232 ms | 55408 KB |
01-05.txt | WA | 240 ms | 55408 KB |
01-06.txt | WA | 232 ms | 55532 KB |
01-07.txt | WA | 233 ms | 55532 KB |
01-08.txt | WA | 234 ms | 55532 KB |
01-09.txt | WA | 243 ms | 55788 KB |
01-10.txt | AC | 294 ms | 66924 KB |
01-11.txt | WA | 308 ms | 79852 KB |
01-12.txt | AC | 202 ms | 52804 KB |
01-13.txt | AC | 243 ms | 60228 KB |
01-14.txt | WA | 228 ms | 61676 KB |
01-15.txt | WA | 227 ms | 61676 KB |
01-16.txt | WA | 228 ms | 61676 KB |
01-17.txt | WA | 230 ms | 61804 KB |
01-18.txt | WA | 249 ms | 61548 KB |
01-19.txt | WA | 266 ms | 62184 KB |
01-20.txt | AC | 262 ms | 82152 KB |
01-21.txt | WA | 222 ms | 52600 KB |
01-22.txt | WA | 220 ms | 52336 KB |
01-23.txt | WA | 221 ms | 52336 KB |
01-24.txt | WA | 229 ms | 52464 KB |
01-25.txt | AC | 262 ms | 60912 KB |
01-26.txt | AC | 272 ms | 73196 KB |
01-27.txt | AC | 239 ms | 70676 KB |
01-28.txt | AC | 224 ms | 62828 KB |
01-29.txt | AC | 216 ms | 49644 KB |
01-30.txt | AC | 197 ms | 60012 KB |
sample-01.txt | AC | 160 ms | 38256 KB |
sample-02.txt | WA | 161 ms | 38256 KB |