Submission #6141591
Source Code Expand
from collections import Counter n,m=map(int,input().split()) x=[int(i) for i in input().split()] v=[[] for i in range(m)] for i in x:v[i%m].append(i) a=0 for i in range(1,m//2+m%2): x,y=v[i],v[m-i] d=len(x)-len(y) if d<0: d=-d x,y=y,x c=sorted([p[1] for p in Counter(x).items()]) p=0 for t in c: p+=(t//2) a+=len(y)+min(p,(d//2)) a+=len(v[0])//2+(len(v[m//2])//2 if m%2==0 else 0) print(a)
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | keroru |
Language | PyPy3 (2.4.0) |
Score | 700 |
Code Size | 433 Byte |
Status | AC |
Exec Time | 499 ms |
Memory | 76780 KB |
Judge Result
Set Name | sample | all | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 700 / 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 | 161 ms | 38256 KB |
01-02.txt | AC | 204 ms | 55920 KB |
01-03.txt | AC | 204 ms | 54384 KB |
01-04.txt | AC | 216 ms | 54256 KB |
01-05.txt | AC | 218 ms | 53104 KB |
01-06.txt | AC | 220 ms | 55404 KB |
01-07.txt | AC | 220 ms | 53612 KB |
01-08.txt | AC | 240 ms | 53100 KB |
01-09.txt | AC | 274 ms | 56556 KB |
01-10.txt | AC | 499 ms | 76780 KB |
01-11.txt | AC | 473 ms | 76396 KB |
01-12.txt | AC | 208 ms | 56772 KB |
01-13.txt | AC | 299 ms | 58308 KB |
01-14.txt | AC | 204 ms | 54380 KB |
01-15.txt | AC | 213 ms | 53996 KB |
01-16.txt | AC | 217 ms | 54380 KB |
01-17.txt | AC | 225 ms | 52460 KB |
01-18.txt | AC | 266 ms | 56172 KB |
01-19.txt | AC | 272 ms | 56428 KB |
01-20.txt | AC | 309 ms | 64108 KB |
01-21.txt | AC | 204 ms | 54380 KB |
01-22.txt | AC | 212 ms | 52336 KB |
01-23.txt | AC | 212 ms | 52336 KB |
01-24.txt | AC | 257 ms | 54384 KB |
01-25.txt | AC | 322 ms | 58736 KB |
01-26.txt | AC | 324 ms | 61420 KB |
01-27.txt | AC | 282 ms | 54036 KB |
01-28.txt | AC | 285 ms | 51888 KB |
01-29.txt | AC | 283 ms | 47724 KB |
01-30.txt | AC | 279 ms | 50096 KB |
sample-01.txt | AC | 162 ms | 38256 KB |
sample-02.txt | AC | 161 ms | 38256 KB |