Submission #1871242
Source Code Expand
#include <algorithm> #include <cctype> #include <complex> #include <iomanip> #include <iostream> #include <queue> #include <set> #include <string> #include <vector> using std::cin; using std::cout; using std::endl; using std::string; using std::to_string; using std::vector; using std::set; using std::queue; using std::priority_queue; using std::min; using std::max; using std::sort; using std::abs; int main() { int n; cin >> n; vector<int> a(1e5 + 1); for (int i = 0; i < n; i++) { int x; cin >> x; a[x - 1]++; } int cnt2 = 0; int cnt1 = 0; for (int i = 0; i <= 1e5; i++) { if (a[i] == 0) { continue; } if(a[i] % 2 == 0){ cnt2++; }else{ cnt1++; } } int cnt = cnt1 + cnt2 - (cnt2 % 2 == 0 ? 0 : 1); cout << cnt << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Card Eater |
User | somq14 |
Language | C++14 (Clang 3.8.0) |
Score | 400 |
Code Size | 951 Byte |
Status | AC |
Exec Time | 81 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 | 6 ms | 640 KB |
03.txt | AC | 1 ms | 640 KB |
04.txt | AC | 2 ms | 640 KB |
05.txt | AC | 1 ms | 640 KB |
06.txt | AC | 79 ms | 640 KB |
07.txt | AC | 80 ms | 640 KB |
08.txt | AC | 81 ms | 640 KB |
09.txt | AC | 78 ms | 640 KB |
10.txt | AC | 80 ms | 640 KB |
11.txt | AC | 79 ms | 640 KB |
12.txt | AC | 79 ms | 640 KB |
13.txt | AC | 79 ms | 640 KB |
14.txt | AC | 77 ms | 640 KB |
15.txt | AC | 76 ms | 640 KB |