Submission #1305627
Source Code Expand
#include<iostream> #include<vector> #include<set> #define loop(i,a,b) for(int i=a;i<b;i++) #define rep(i,a) loop(i,0,a) #define pb push_back using namespace std; vector<int> a,same; set<int> s; int dsize; int main(){ int n,in; cin>>n; rep(i,n){ cin>>in; a.pb(in); } set<int>::iterator ite; int see=0; while(see<a.size()){ ite=s.find(a[see]); if(ite!=s.end()){ same.pb(a[see]); a.erase(a.begin()+see); }else{ s.insert(a[see]); see++; } } dsize=s.size(); int res1,res2,result=a.size(); if(dsize%2){ res1=same[dsize/2-1],res2=same[dsize/2]; if(res1>res2){ int alt=res1; res1=res2; res2=alt; } bool alt=true; rep(i,n)if(res1<=a[i] && a[i]<=res2)alt=false; if(alt)result-=2; }else result-=1; cout<<result<<endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Card Eater |
User | tuki_remon |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 825 Byte |
Status | RE |
Exec Time | 749 ms |
Memory | 5368 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 | 96 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | AC | 748 ms | 1400 KB |
07.txt | AC | 742 ms | 1400 KB |
08.txt | AC | 637 ms | 1912 KB |
09.txt | AC | 742 ms | 1400 KB |
10.txt | AC | 747 ms | 1400 KB |
11.txt | AC | 661 ms | 1784 KB |
12.txt | AC | 749 ms | 1400 KB |
13.txt | AC | 717 ms | 1528 KB |
14.txt | RE | 166 ms | 5368 KB |
15.txt | AC | 740 ms | 1400 KB |