Task: | Mex-luku |
Sender: | Senpai |
Submission time: | 2017-01-19 14:49:19 +0200 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:21:26: error: expected ')' before '{' token if(s.count(v[i-k+1]+1)==1{ ^ input/code.cpp:23:1: error: expected primary-expression before '}' token } ^ input/code.cpp:23:1: error: expected ';' before '}' token
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; d=1000000001; 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); s.insert(x+1); if(s.count(1)==0)cout<<*s.begin()<<" "; else cout<<0<<" "; if(s.count(v[i-k+1]+1)==1{ s.erase(s.find(v[i-k+1]+1));} } }