Submission #1189900
Source Code Expand
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { long long N; long long count = 0; vector<long long> A; vector<long long> B; cin >> N; for ( long long i = 0; i < N; i++ ) { long long a; cin >> a; A.push_back(a); } sort( A.begin(), A.end() ); for ( long long i = 1; i < N; i++ ) { if ( A[i-1] == A[i] ) { B.push_back( A[i] ); } } for ( ;; ) { if ( B.size() <= 2 ) { break; } if ( B.front() == B.back() ) { break;} B.erase( B.begin() ); B.pop_back(); count++; } if ( B.front() == B.back() ) { count += ( B.size() / 2 ); count += B.size() % 2; } else if ( B.size() == 2 ) { bool is_between = false; for ( long long i = 0; i < N; i++ ) { if ( B[0] < A[i] && A[i] > B[1] ) { is_between = true; break; } } if ( is_between ) { count++; } else { count += 2; } } cout << N - ( count*2 ) << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Card Eater |
User | tetsuzuki1115 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1353 Byte |
Status | RE |
Exec Time | 761 ms |
Memory | 2548 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 256 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
01.txt | AC | 1 ms | 256 KB |
02.txt | AC | 5 ms | 384 KB |
03.txt | RE | 97 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | AC | 760 ms | 2548 KB |
07.txt | AC | 760 ms | 2548 KB |
08.txt | AC | 632 ms | 2548 KB |
09.txt | AC | 760 ms | 2548 KB |
10.txt | AC | 760 ms | 2548 KB |
11.txt | AC | 658 ms | 2548 KB |
12.txt | AC | 761 ms | 2548 KB |
13.txt | AC | 727 ms | 2548 KB |
14.txt | RE | 127 ms | 1400 KB |
15.txt | AC | 32 ms | 2548 KB |