Submission #3222594
Source Code Expand
#include <bits/stdc++.h> using namespace std; using lint = long long int; template<class T = int> using V = vector<T>; template<class T = int> using VV = V< V<T> >; template<class T> void assign(V<T>& v, int n, const auto& a = T()) { v.assign(n, a); } template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); } const int max_n = 1e5; int main() { cin.tie(NULL); ios::sync_with_stdio(false); int n, m; cin >> n >> m; V<> c(max_n + 1); for (int i = 0; i < n; i++) { int x; cin >> x; c[x]++; } V<> r(m), p(m); for (int i = 1; i < max_n + 1; i++) { r[i % m] += c[i]; p[i % m] += c[i] / 2; } int res = r[0] / 2; for (int i = 1; i < (m + 1) / 2; i++) { if (r[i] > r[m - i]) res += r[m - i] + min((r[i] - r[m - i]) / 2, p[i]); else res += r[i] + min((r[m - i], r[i]) / 2, p[m - i]); } if (!(m & 1)) res += r[m / 2] / 2; cout << res << '\n'; }
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | risujiroh |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 982 Byte |
Status | WA |
Exec Time | 10 ms |
Memory | 1408 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 | 2 ms | 640 KB |
01-02.txt | AC | 10 ms | 640 KB |
01-03.txt | AC | 10 ms | 640 KB |
01-04.txt | WA | 10 ms | 640 KB |
01-05.txt | AC | 10 ms | 640 KB |
01-06.txt | WA | 10 ms | 640 KB |
01-07.txt | WA | 10 ms | 640 KB |
01-08.txt | WA | 10 ms | 640 KB |
01-09.txt | WA | 10 ms | 640 KB |
01-10.txt | WA | 10 ms | 1024 KB |
01-11.txt | WA | 10 ms | 1408 KB |
01-12.txt | AC | 9 ms | 640 KB |
01-13.txt | AC | 10 ms | 1024 KB |
01-14.txt | AC | 10 ms | 640 KB |
01-15.txt | AC | 10 ms | 640 KB |
01-16.txt | AC | 10 ms | 640 KB |
01-17.txt | AC | 10 ms | 640 KB |
01-18.txt | AC | 10 ms | 640 KB |
01-19.txt | AC | 10 ms | 768 KB |
01-20.txt | AC | 10 ms | 1408 KB |
01-21.txt | AC | 9 ms | 640 KB |
01-22.txt | WA | 10 ms | 640 KB |
01-23.txt | WA | 10 ms | 640 KB |
01-24.txt | WA | 10 ms | 640 KB |
01-25.txt | WA | 10 ms | 896 KB |
01-26.txt | WA | 10 ms | 1408 KB |
01-27.txt | AC | 6 ms | 1408 KB |
01-28.txt | WA | 3 ms | 1408 KB |
01-29.txt | AC | 2 ms | 1024 KB |
01-30.txt | AC | 2 ms | 1408 KB |
sample-01.txt | AC | 2 ms | 640 KB |
sample-02.txt | AC | 2 ms | 640 KB |