Submission #5548410
Source Code Expand
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <list>
#include <string>
typedef char SINT8;
typedef unsigned char UINT8;
typedef short SINT16;
typedef unsigned short UINT16;
typedef int SINT32;
typedef unsigned int UINT32;
typedef long long SINT64;
typedef unsigned long long UINT64;
typedef double DOUBLE;
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)
#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "
#define pute(a) cout << endl
#define INF 1000000001
#define MOD 1000000007
#define INF64 1000000000000000001
#define F first
#define S second
#define Pii pair<SINT32,SINT32>
#define Pll pair<SINT64,SINT64>
#define Piii pair<SINT32,pair<SINT32,SINT32>>
#define Plll pair<SINT64,pair<SINT64,SINT64>>
using namespace std;
int main() {
SINT64 N;
cin >> N;
SINT64 cnt = 0;
vector<SINT64> data(100001);
rep(i,0,N) {
SINT64 buf;
cin >> buf;
data[buf]++;
}
rep(i,0,100001) {
if (data[i] >= 2) {
cnt += data[i]-1;
}
}
if ((cnt % 2) == 0) {
put(N-cnt);
} else {
put(N-cnt-1);
}
return 0;
}
// sort(data.begin(),data.end());
// sort(data.begin(),data.end(),std::greater<SINT32>());
// __gcd(A,B);
// data.emplace_back(BUF); //後ろに追加
// data.erase(std::unique(data.begin(), data.end()), data.end()); //ソート後に使用 同じ値を消す
// data.insert(data.begin() + X, 0); //X番目の要素に0を挿入
// vector<vector<SINT32>> data(N,vector<SINT32>(3)); //2次元配列
/*
vector<Pii> data(N);
rep(i,0,N) {
cin >> data[i].F;
cin >> data[i].S;
}
sort(data.begin(),data.end());
*/
/*
vector<Piii> data(N);
rep(i,0,N) {
cin >> data[i].F;
cin >> data[i].S.F;
cin >> data[i].S.S;
}
sort(data.begin(),data.end());
*/
// posi = lower_bound(data.begin(),data.end(), X) - data.begin(); // X以上を探す
// posi = lower_bound(data.begin(),data.end(),make_pair(X,0)) - data.begin(); //pair
/* 文字列回転
string N;
cin >> N;
N = N[N.length()-1] + N.substr(0,N.length()-1);
s = to_string(i); //ストリング変換
*/
/* 文字列合成
string N,M;
cin >> N >> M;
SINT64 ans = 0;
ans = stoi(N+M);
*/
/*
//ワーシャルフロイド
vector<vector<SINT32>> dist(N,vector<SINT32>(N));
rep(i,0,N) {
rep(j,0,N) {
if (i != j) {
dist[i][j] = INF;
}
}
}
rep(k,0,N) {
rep(i,0,N) {
rep(j,0,N) {
dist[i][j] = MIN(dist[i][j], dist[i][k]+dist[k][j]);
}
}
}
*/
/* 優先度付きキュー
priority_queue<SINT64, vector<SINT64>, greater<SINT64>> data; //小さいほうから取り出せる
priority_queue<SINT64, vector<SINT64>> data; //大きいほうから取り出せる
data.push(X); //X を挿入
data.top(); //先頭データ読み
data.pop(); //先頭データ削除
*/
/* SET コンテナ
set<SINT64> data;
data.insert(X); //X を挿入
data.erase(data.begin()); //先頭を削除
data.erase(--data.end()); //末尾を削除
*data.begin(); //先頭要素にアクセス
*data.rbegin(); //末尾要素にアクセス
//全表示
set<SINT64>::iterator it; //イテレータを用意
for(it = data.begin(); it != data.end(); it++) {
cout << *it << " ";
}
cout << endl;
//N番目を一部表示
set<SINT64>::iterator it; // イテレータを用意
it = data.begin();
rep (i,0,N) {
it++;
}
cout << *it << endl;
*/
/* map
map<string,SINT32> mp;
SINT32 N = 0;
SINT32 mx = 0;
cin >> N;
for (SINT32 i = 0; i < N; i++) {
string s;
cin >> s;
mp[s]++;
}
for(auto it=mp.begin();it!=mp.end();it++) {
mx=max(mx,it->second);
}
*/
/*
//順列全表示
//sortしてからでないと全列挙にならない
sort(data.begin(),data.end());
do {
cout << buf << endl;
rep(i,0,R) {
cout << data[i] << " ";
}
cout << endl;
} while (next_permutation(data.begin(),data.end()));
*/
// 桁指定表示
// ans = ans * M_PI;
// cout << setprecision(15) << ans << endl;
Submission Info
Submission Time |
|
Task |
D - Card Eater |
User |
m_m |
Language |
C++14 (GCC 5.4.1) |
Score |
400 |
Code Size |
4461 Byte |
Status |
AC |
Exec Time |
30 ms |
Memory |
1024 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 |
2 ms |
1024 KB |
00_example_02.txt |
AC |
2 ms |
1024 KB |
01.txt |
AC |
2 ms |
1024 KB |
02.txt |
AC |
3 ms |
1024 KB |
03.txt |
AC |
2 ms |
1024 KB |
04.txt |
AC |
2 ms |
1024 KB |
05.txt |
AC |
2 ms |
1024 KB |
06.txt |
AC |
29 ms |
1024 KB |
07.txt |
AC |
29 ms |
1024 KB |
08.txt |
AC |
29 ms |
1024 KB |
09.txt |
AC |
29 ms |
1024 KB |
10.txt |
AC |
30 ms |
1024 KB |
11.txt |
AC |
29 ms |
1024 KB |
12.txt |
AC |
29 ms |
1024 KB |
13.txt |
AC |
29 ms |
1024 KB |
14.txt |
AC |
29 ms |
1024 KB |
15.txt |
AC |
29 ms |
1024 KB |