Submission #992553
Source Code Expand
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < n; i++) #define PI 3.1415926535897932384626433832795028841971 #define INF 100000000 #define EPS 1e-10 #define MOD 1000000007 using namespace std; typedef long long ll; typedef pair<ll,ll> P; ll n, m; ll x[100001]; ll hoge[100001]; map<ll,ll> ma; map<ll,ll>::iterator it; int main(){ cin >> n >> m; rep(i,n){ ll y; cin >> y; ma[y]++; x[y%m]++; } for(it = ma.begin(); it != ma.end(); it++){ ll p = (*it).first, q = (*it).second; hoge[p%m] += q/2; } ll ans = 0; rep(i,n-1){ ans += min(x[i+1],x[m-i-1]); ll z = min(x[i+1],x[m-i-1]); x[i+1] -= z; x[m-i-1] -= z; } rep(i,n){ ans += min(hoge[i],x[i]/2); } cout << ans << endl; }
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | gasin |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 878 Byte |
Status | WA |
Exec Time | 91 ms |
Memory | 8064 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 | 2 ms | 256 KB |
01-02.txt | WA | 81 ms | 5760 KB |
01-03.txt | WA | 81 ms | 5760 KB |
01-04.txt | WA | 81 ms | 5760 KB |
01-05.txt | WA | 79 ms | 5760 KB |
01-06.txt | WA | 79 ms | 5760 KB |
01-07.txt | WA | 82 ms | 5760 KB |
01-08.txt | WA | 80 ms | 5760 KB |
01-09.txt | WA | 81 ms | 5760 KB |
01-10.txt | AC | 74 ms | 5760 KB |
01-11.txt | WA | 81 ms | 5760 KB |
01-12.txt | AC | 48 ms | 1792 KB |
01-13.txt | AC | 48 ms | 1408 KB |
01-14.txt | WA | 89 ms | 8064 KB |
01-15.txt | WA | 91 ms | 8064 KB |
01-16.txt | WA | 86 ms | 8064 KB |
01-17.txt | WA | 90 ms | 8064 KB |
01-18.txt | WA | 91 ms | 8064 KB |
01-19.txt | WA | 90 ms | 8064 KB |
01-20.txt | WA | 90 ms | 8064 KB |
01-21.txt | WA | 58 ms | 2048 KB |
01-22.txt | WA | 57 ms | 2048 KB |
01-23.txt | WA | 57 ms | 2048 KB |
01-24.txt | AC | 58 ms | 2048 KB |
01-25.txt | AC | 55 ms | 2048 KB |
01-26.txt | AC | 57 ms | 2048 KB |
01-27.txt | AC | 43 ms | 4480 KB |
01-28.txt | WA | 6 ms | 2048 KB |
01-29.txt | WA | 4 ms | 896 KB |
01-30.txt | AC | 3 ms | 384 KB |
sample-01.txt | AC | 3 ms | 256 KB |
sample-02.txt | AC | 3 ms | 256 KB |