Submission #1082208
Source Code Expand
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
#define debug( fmt, ... ) \
fprintf( stderr, \
fmt "\n", \
##__VA_ARGS__ \
)
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const double EPS = 1e-10;
double zero(double d) {
return d < EPS ? 0.0 : d;
}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
return os << '(' << p.first << ',' << p.second << ')';
}
template<typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
os << '[';
rep(i, a.size()) os << (i ? " " : "") << a[i];
return os << ']';
}
string toString(int i) {
stringstream ss;
ss << i;
return ss.str();
}
const int MOD = 1000000007;
// a^k
ll fpow(ll a, ll k, int M) {
ll res = 1ll;
ll x = a;
while (k != 0) {
if ((k & 1) == 1)
res = (res * x) % M;
x = (x * x) % M;
k >>= 1;
}
return res;
}
struct prepare {
prepare() {
cout.setf(ios::fixed, ios::floatfield);
cout.precision(8);
ios_base::sync_with_stdio(false);
}
} _prepare;
int main() {
int N;
cin >> N;
map<int, int> a;
rep(i, N) {
int t;
cin >> t;
a[t] ++;
}
ll ans = 0;
tr(it, a) {
while(it->second >= 3) {
ans++;
it->second -= 2;
}
}
ll num_t = 0;
tr(it, a) {
if(it->second == 2)
num_t ++;
}
ll step = ans + ((num_t + 1) / 2);
cout << N - step*2 << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Card Eater |
User |
palpal |
Language |
C++11 (GCC 4.8.1) |
Score |
400 |
Code Size |
3373 Byte |
Status |
AC |
Exec Time |
38 ms |
Memory |
4992 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
400 / 400 |
Status |
|
|
Set Name |
Test Cases |
Sample |
00_example_01.txt, 00_example_02.txt |
All |
00_example_01.txt, 00_example_02.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt |
Case Name |
Status |
Exec Time |
Memory |
00_example_01.txt |
AC |
3 ms |
256 KB |
00_example_02.txt |
AC |
3 ms |
256 KB |
01.txt |
AC |
3 ms |
256 KB |
02.txt |
AC |
3 ms |
256 KB |
03.txt |
AC |
3 ms |
256 KB |
04.txt |
AC |
3 ms |
256 KB |
05.txt |
AC |
2 ms |
256 KB |
06.txt |
AC |
15 ms |
256 KB |
07.txt |
AC |
15 ms |
256 KB |
08.txt |
AC |
25 ms |
640 KB |
09.txt |
AC |
14 ms |
256 KB |
10.txt |
AC |
14 ms |
256 KB |
11.txt |
AC |
24 ms |
640 KB |
12.txt |
AC |
15 ms |
256 KB |
13.txt |
AC |
20 ms |
384 KB |
14.txt |
AC |
38 ms |
4992 KB |
15.txt |
AC |
12 ms |
256 KB |