Submission #5671873
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 < 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 == j: #i==0は最初のifにかかってしまうため注意 ans += a[i] //2 print(ans)
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | siiiii1107 |
Language | PyPy3 (2.4.0) |
Score | 0 |
Code Size | 546 Byte |
Status | WA |
Exec Time | 313 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 | AC | 163 ms | 38256 KB |
01-02.txt | WA | 232 ms | 55664 KB |
01-03.txt | WA | 231 ms | 55408 KB |
01-04.txt | WA | 230 ms | 55408 KB |
01-05.txt | WA | 231 ms | 55408 KB |
01-06.txt | WA | 229 ms | 55532 KB |
01-07.txt | WA | 232 ms | 55532 KB |
01-08.txt | WA | 233 ms | 55532 KB |
01-09.txt | WA | 245 ms | 55788 KB |
01-10.txt | AC | 298 ms | 66924 KB |
01-11.txt | WA | 313 ms | 79852 KB |
01-12.txt | AC | 203 ms | 52804 KB |
01-13.txt | AC | 248 ms | 60100 KB |
01-14.txt | AC | 231 ms | 61676 KB |
01-15.txt | AC | 231 ms | 61676 KB |
01-16.txt | AC | 231 ms | 61676 KB |
01-17.txt | AC | 234 ms | 61804 KB |
01-18.txt | AC | 254 ms | 61548 KB |
01-19.txt | AC | 264 ms | 62312 KB |
01-20.txt | AC | 270 ms | 82152 KB |
01-21.txt | WA | 230 ms | 52332 KB |
01-22.txt | WA | 224 ms | 52336 KB |
01-23.txt | WA | 224 ms | 52336 KB |
01-24.txt | WA | 235 ms | 52464 KB |
01-25.txt | AC | 266 ms | 60912 KB |
01-26.txt | AC | 276 ms | 73196 KB |
01-27.txt | AC | 242 ms | 70676 KB |
01-28.txt | AC | 227 ms | 62828 KB |
01-29.txt | AC | 219 ms | 49516 KB |
01-30.txt | AC | 199 ms | 60012 KB |
sample-01.txt | AC | 165 ms | 38256 KB |
sample-02.txt | AC | 165 ms | 38256 KB |