Submission #5376140
Source Code Expand
#define _UsecondE_MATH_DEfirstINEsecond #define _CRT_secondECURE_NO_WARNINGsecond #include <bits/stdc++.h> using namespace std; /*BigInteger #include <boost/multiprecision/cpp_dec_float.hpp> #include <boost/multiprecision/cpp_int.hpp> #include <boost/rational.hpp> namespace xxx = boost::multiprecision; using Bint = xxx::cpp_int; using Real = xxx::number<xxx::cpp_dec_float<1024>>; */ #define int long long #define pb(x) push_back(x) #define m0(x) memset((x), 0LL, sizeof(x)) #define mm(x) memset((x), -1LL, sizeof(x)) //container #define ALL(x) (x).begin(), (x).end() #define RALL(a) (a).rbegin(), (a).rend() #define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i) #define EXIsecondT(s, e) ((s).find(e) != (s).end()) #define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end()); #define PERM(c) \ sort(ALL(c)); \ for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c))) // debug #define GET_VAR_NAME(variable) #variable #define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl; // bit_macro #define Bit(n) (1LL << (n)) #define Bitset(a, b) (a) |= (1LL << (b)) #define Bitunset(a, b) (a) &= ~(1LL << (b)) #define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL) #define Bitcount(a) __builtin_popcountint((a)) //typedef typedef long long lint; typedef unsigned long long uint; typedef complex<long double> Complex; typedef pair<int, int> P; typedef tuple<int, int, int> TP; typedef vector<int> vec; typedef vector<vec> mat; //constant constexpr int INfirst = (int)1e18; constexpr int MOD = (int)1e9 + 7; constexpr double PI = (double)acos(-1); constexpr double EPsecond = (double)1e-10; constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1}; constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1}; // template <typename T> void chmax(T &a, T b) { a = max(a, b); } template <typename T> void chmin(T &a, T b) { a = min(a, b); } // inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } template <class T> inline string tosecondtring(T x) { ostringstream sout; sout << x; return sout.str(); } // struct Accelerate_Cin { Accelerate_Cin() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(20); }; } Accelerate_Cin; signed main() { int n, m; cin >> n >> m; vector<P> cnt(100010); vector<int> pint(100010); for (int i = 0; i < n; i++) { int num; cin >> num; pint[num]++; } for (int i = 0; i < 100010; i++) { if (pint[i] > 0) { cnt[i % m].first += pint[i]; cnt[i % m].second += pint[i] / 2; } } int ans = 0; ans += cnt[0].first / 2; for (int i = 1; i <= m / 2; i++) { if (i == m - i) { ans += cnt[i].first / 2; } else { ans += min(cnt[i].first, cnt[m - i].first); if (cnt[i].first > cnt[m - i].first) { ans += min(cnt[i].second, (cnt[i].first - cnt[m - i].first) / 2); } else { ans += min(cnt[m - i].second, (cnt[m - i].first - cnt[i].first) / 2); } } } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Pair Cards |
User | null_null |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 3142 Byte |
Status | CE |
Compile Error
./Main.cpp:43:28: error: conflicting declaration ‘typedef long long unsigned int uint’ typedef unsigned long long uint; ^ In file included from /usr/include/stdlib.h:314:0, from /usr/include/c++/5/cstdlib:72, from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:47, from ./Main.cpp:3: /usr/include/x86_64-linux-gnu/sys/types.h:152:22: note: previous declaration as ‘typedef unsigned int uint’ typedef unsigned int uint; ^