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

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:23:16: error: expected ';' before 's'
 (s.count(d)==0)s.insert(d);}
                ^

Code

#include <bits/stdc++.h>
using namespace std;
long long n,k,x,d;
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);
if(s.count(x)==0)s.insert(x+1);}
for(int i=k-1; i<n; i++){
cin>>x;
v.push_back(x);
if(s.count(x)==0)s.insert(x+1);
if(s.count(1)==0)cout<<*s.begin()<<" ";
else cout<<0<<" ";
d=v[i-k+1];
if(s.count(d+1)==1){
s.erase(s.find(d+1));
(s.count(d)==0)s.insert(d);}
}

}