Submission #5556188
Source Code Expand
#pragma region include
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstdio>
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define MOD 1000000007
#define INF 1000000000
#define LLINF 4000000000000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#pragma endregion
//#define __DEBUG__
#ifdef __DEBUG__
#define dump(x) cerr << #x << " = " << (x) << " [" << __LINE__ << ":" << __FUNCTION__ << "] " << endl;
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& v) {
os << "{";
REP(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
os << "}";
return os;
}
// pair出力
template<typename T, typename U>
ostream& operator << (ostream& os, pair<T, U>& p) {
return os << "(" << p.first << ", " << p.second << ")";
}
// map出力
template<typename T, typename U>
ostream& operator << (ostream& os, map<T, U>& map_var) {
os << "{";
for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
os << "(" << itr->first << ", " << itr->second << ")";
itr++;
if (itr != map_var.end()) os << ", ";
itr--;
}
os << "}";
return os;
}
// set 出力
template<typename T>
ostream& operator << (ostream& os, set<T>& set_var) {
os << "{";
for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
os << *itr;
++itr;
if (itr != set_var.end()) os << ", ";
itr--;
}
os << "}";
return os;
}
#endif
int main() {
cin.tie(0); ios::sync_with_stdio(false);
int N, cnt = 0,ans = 0; cin >> N;
VI A(100000, 0);
REP(i, N) {
int a;
cin >> a;
a--;
A[a]++;
}
REP(i, 100000) {
if (A[i] == 0) continue;
ans++;
if (A[i] % 2 == 0) {
cnt++;
}
}
if (cnt % 2 == 1) ans--;
cout << ans << endl;
getchar(); getchar();
}
Submission Info
Submission Time |
|
Task |
D - Card Eater |
User |
kanpurin |
Language |
C++14 (GCC 5.4.1) |
Score |
400 |
Code Size |
2341 Byte |
Status |
AC |
Exec Time |
9 ms |
Memory |
640 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 |
1 ms |
640 KB |
00_example_02.txt |
AC |
1 ms |
640 KB |
01.txt |
AC |
1 ms |
640 KB |
02.txt |
AC |
2 ms |
640 KB |
03.txt |
AC |
1 ms |
640 KB |
04.txt |
AC |
1 ms |
640 KB |
05.txt |
AC |
1 ms |
640 KB |
06.txt |
AC |
9 ms |
640 KB |
07.txt |
AC |
9 ms |
640 KB |
08.txt |
AC |
9 ms |
640 KB |
09.txt |
AC |
9 ms |
640 KB |
10.txt |
AC |
9 ms |
640 KB |
11.txt |
AC |
9 ms |
640 KB |
12.txt |
AC |
9 ms |
640 KB |
13.txt |
AC |
9 ms |
640 KB |
14.txt |
AC |
9 ms |
640 KB |
15.txt |
AC |
9 ms |
640 KB |