CSES - Datatähti 2017 loppu - Results
Submission details
Task:Mex-luku
Sender:Senpai
Submission time:2017-01-19 16:57:29 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:33:1: error: expected ';' before '}' token
 }
 ^

Code

#include <bits/stdc++.h>
using namespace std;
long long n,k,x,d,e;
vector<int>v;
multiset<int>s;
multiset<int>t;
int main(){
cin>>n>>k;
for(int i=0; i<k-1; i++){
cin>>x;
v.push_back(x);
t.insert(x);
}

for(int i=k-1; i<n; i++){
cin>>x;
v.push_back(x);
t.insert(x);
auto it=t.begin();
auto ti=t.begin();
ti++;
if(t.count(1)==0) cout<<0<<" ";
else{
while(*it==*ti){
it++;
ti++;}
e=*it;
cout<<e+1<<" ";
}
d=v[i-k+1];
t.erase(d)

}

}