Submission #993484
Source Code Expand
#!/usr/bin/env python3 # -*- coding:utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from collections import Counter N, M = map(int, input().split()) X = list(map(int, input().split())) XX = [x % M for x in X] # print(Counter(X)) cc = Counter(X) c = Counter(XX) cnt = c[0] // 2 c[0] -= cnt * 2 if M % 2 == 1: to = M // 2 + 1 else: to = M // 2 tmp = c[M//2] // 2 c[M//2] -= tmp * 2 cnt += tmp for i in range(1, to): # print(i, M-i, c[i], c[M-i]) tmp = min(c[i], c[M-i]) cnt += tmp c[i] -= tmp c[M-i] -= tmp # print(c) # print(cc) for i in cc: if cc[i] >= 2: if c[i % M] >= 2: tmp = c[i % M] // 2 cnt += tmp c[i % M] -= tmp * 2 # print(cc[i]) # print(c[i % M], i, cc[i]) print(c) print(cnt)
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | ioryz |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 963 Byte |
Status | WA |
Exec Time | 455 ms |
Memory | 39388 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 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | WA | 455 ms | 3444 KB |
01-02.txt | WA | 102 ms | 15716 KB |
01-03.txt | WA | 105 ms | 15716 KB |
01-04.txt | WA | 103 ms | 15972 KB |
01-05.txt | WA | 103 ms | 15332 KB |
01-06.txt | WA | 103 ms | 15588 KB |
01-07.txt | WA | 105 ms | 15204 KB |
01-08.txt | WA | 110 ms | 16228 KB |
01-09.txt | WA | 115 ms | 17124 KB |
01-10.txt | WA | 186 ms | 21464 KB |
01-11.txt | WA | 315 ms | 34396 KB |
01-12.txt | WA | 79 ms | 14348 KB |
01-13.txt | WA | 163 ms | 21948 KB |
01-14.txt | WA | 111 ms | 19808 KB |
01-15.txt | WA | 111 ms | 20704 KB |
01-16.txt | WA | 112 ms | 20576 KB |
01-17.txt | WA | 115 ms | 20704 KB |
01-18.txt | WA | 124 ms | 21856 KB |
01-19.txt | WA | 135 ms | 21856 KB |
01-20.txt | WA | 261 ms | 39388 KB |
01-21.txt | WA | 83 ms | 14196 KB |
01-22.txt | WA | 82 ms | 14196 KB |
01-23.txt | WA | 83 ms | 14196 KB |
01-24.txt | WA | 90 ms | 14196 KB |
01-25.txt | WA | 144 ms | 18264 KB |
01-26.txt | WA | 258 ms | 32196 KB |
01-27.txt | WA | 229 ms | 30736 KB |
01-28.txt | WA | 203 ms | 27180 KB |
01-29.txt | WA | 90 ms | 11768 KB |
01-30.txt | WA | 194 ms | 27592 KB |
sample-01.txt | WA | 26 ms | 3316 KB |
sample-02.txt | WA | 26 ms | 3316 KB |