Submission #11351066
Source Code Expand
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.StringJoiner; import java.util.StringTokenizer; import java.util.function.IntUnaryOperator; import java.util.function.LongUnaryOperator; public class Main { static In in = new In(); static Out out = new Out(); static long mod = 1000000007; static long inf = 0xfffffffffffffffL; void solve() { int n = in.nextInt(); int m = in.nextInt(); int[] count = new int[m]; for (int i = 0; i < n; i++) { int x = in.nextInt(); count[x % m]++; } long ans = 0; for (int i = 0; i < m / 2; i++) { if (i * 2 == m) { ans += count[i] / 2; } else { ans += (count[i] + count[m - 1 - i]) / 2; } } out.println(ans); } public static void main(String[]$) { new Main().solve(); out.flush(); } } class In { private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 0x10000); private StringTokenizer tokenizer; String next() { try { while (tokenizer == null || !tokenizer.hasMoreTokens()) { tokenizer = new StringTokenizer(reader.readLine()); } } catch (IOException ignored) { } return tokenizer.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } char[][] nextCharArray(int n, int m) { char[][] a = new char[n][m]; for (int i = 0; i < n; i++) { a[i] = next().toCharArray(); } return a; } int[] nextIntArray(int n) { int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } int[] nextIntArray(int n, IntUnaryOperator op) { int[] a = new int[n]; for (int i = 0; i < n; i++) { a[i] = op.applyAsInt(nextInt()); } return a; } long[] nextLongArray(int n) { long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = nextLong(); } return a; } long[] nextLongArray(int n, LongUnaryOperator op) { long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = op.applyAsLong(nextLong()); } return a; } } class Out { private PrintWriter out = new PrintWriter(System.out); boolean autoFlush = false; void println(Object... a) { StringJoiner joiner = new StringJoiner(" "); for (Object obj : a) { joiner.add(String.valueOf(obj)); } out.println(joiner); if (autoFlush) { out.flush(); } } void println(int[] a) { StringJoiner joiner = new StringJoiner(" "); for (int i : a) { joiner.add(Integer.toString(i)); } out.println(joiner); if (autoFlush) { out.flush(); } } void println(long[] a) { StringJoiner joiner = new StringJoiner(" "); for (long i : a) { joiner.add(Long.toString(i)); } out.println(joiner); if (autoFlush) { out.flush(); } } void flush() { out.flush(); } }
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | Yu_212 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 3607 Byte |
Status | WA |
Exec Time | 183 ms |
Memory | 34024 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 | 79 ms | 21332 KB |
01-02.txt | WA | 170 ms | 34024 KB |
01-03.txt | AC | 177 ms | 31712 KB |
01-04.txt | WA | 183 ms | 33808 KB |
01-05.txt | WA | 171 ms | 32020 KB |
01-06.txt | WA | 183 ms | 31200 KB |
01-07.txt | WA | 170 ms | 33252 KB |
01-08.txt | WA | 179 ms | 33564 KB |
01-09.txt | WA | 168 ms | 30524 KB |
01-10.txt | WA | 173 ms | 30300 KB |
01-11.txt | WA | 175 ms | 30868 KB |
01-12.txt | AC | 170 ms | 31716 KB |
01-13.txt | AC | 170 ms | 33760 KB |
01-14.txt | AC | 174 ms | 30376 KB |
01-15.txt | WA | 176 ms | 31536 KB |
01-16.txt | WA | 182 ms | 30092 KB |
01-17.txt | WA | 174 ms | 33044 KB |
01-18.txt | WA | 178 ms | 29620 KB |
01-19.txt | WA | 178 ms | 33808 KB |
01-20.txt | WA | 182 ms | 29560 KB |
01-21.txt | WA | 173 ms | 33684 KB |
01-22.txt | WA | 162 ms | 30996 KB |
01-23.txt | WA | 167 ms | 30952 KB |
01-24.txt | WA | 173 ms | 32652 KB |
01-25.txt | WA | 170 ms | 30052 KB |
01-26.txt | WA | 177 ms | 33384 KB |
01-27.txt | WA | 141 ms | 28396 KB |
01-28.txt | WA | 89 ms | 18772 KB |
01-29.txt | WA | 91 ms | 19668 KB |
01-30.txt | AC | 80 ms | 21460 KB |
sample-01.txt | WA | 76 ms | 20820 KB |
sample-02.txt | AC | 75 ms | 19540 KB |