Submission #7913707
Source Code Expand
import sys input = sys.stdin.readline from collections import Counter N, M = map(int, input().split()) X = list(map(int, input().split())) def main(): P = [[] for _ in range(M)] for x in X: P[x%M].append(x) ans = 0 checked = [False]*M for m in range(M): if checked[m]: continue if m == 0: ans += len(P[m])//2 else: L1, L2 = len(P[m]), len(P[M-m]) if L1 > L2: ans += L2 C1 = Counter(P[m]) n = 0 for num, c1 in C1.items(): if c1 % 2 != 0: n += 1 if L2 >= n: ans += (L1-L2)//2 else: ans += (L1-n)//2 else: ans += L1 C2 = Counter(P[M-m]) n = 0 for num, c2 in C2.items(): if c2 % 2 != 0: n += 1 if L1 >= n: ans += (L2-L1)//2 else: ans += (L2-n)//2 checked[m] = True checked[M-m] = True print(ans) if __name__ == "__main__": main()
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | wattaihei |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 1289 Byte |
Status | WA |
Exec Time | 403 ms |
Memory | 19876 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 | 20 ms | 3316 KB |
01-02.txt | AC | 54 ms | 14132 KB |
01-03.txt | WA | 64 ms | 14132 KB |
01-04.txt | AC | 60 ms | 14132 KB |
01-05.txt | WA | 65 ms | 14132 KB |
01-06.txt | AC | 63 ms | 14132 KB |
01-07.txt | WA | 63 ms | 14132 KB |
01-08.txt | AC | 68 ms | 14132 KB |
01-09.txt | WA | 75 ms | 14132 KB |
01-10.txt | WA | 206 ms | 14132 KB |
01-11.txt | WA | 403 ms | 18212 KB |
01-12.txt | AC | 62 ms | 13656 KB |
01-13.txt | AC | 196 ms | 13656 KB |
01-14.txt | WA | 66 ms | 15012 KB |
01-15.txt | AC | 62 ms | 14132 KB |
01-16.txt | WA | 66 ms | 14132 KB |
01-17.txt | AC | 67 ms | 14132 KB |
01-18.txt | AC | 77 ms | 14132 KB |
01-19.txt | AC | 109 ms | 14132 KB |
01-20.txt | WA | 393 ms | 19876 KB |
01-21.txt | WA | 60 ms | 14132 KB |
01-22.txt | AC | 59 ms | 14132 KB |
01-23.txt | WA | 61 ms | 14132 KB |
01-24.txt | AC | 71 ms | 14132 KB |
01-25.txt | AC | 167 ms | 14132 KB |
01-26.txt | AC | 367 ms | 16420 KB |
01-27.txt | WA | 370 ms | 15536 KB |
01-28.txt | AC | 318 ms | 11544 KB |
01-29.txt | AC | 141 ms | 6616 KB |
01-30.txt | AC | 318 ms | 11332 KB |
sample-01.txt | AC | 20 ms | 3316 KB |
sample-02.txt | WA | 20 ms | 3316 KB |