Task: | Taulukko |
Sender: | Tume7 |
Submission time: | 2020-01-05 23:03:49 +0200 |
Language: | C++ (C++17) |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:22:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] while(s.size() <= k && oikea < n){ ~~~~~~~~~^~~~ input/code.cpp:22:32: error: 'oikea' was not declared in this scope while(s.size() <= k && oikea < n){ ^~~~~
Code
#include <bits/stdc++.h> using namespace std; int n, k; long long c=0; int t[1010101]; set<int> s; int main(){ cin>>n>>k; for(int i=0; i<n; i++)cin>>t[i]; for(int vasen=0; vasen<n; vasen++){ s.insert(t[vasen]); while(s.size() <= k && oikea < n){ s.insert(t[oikea]); c++; oikea++; } s.erase(t[vasen]); } cout<<c<<"\n"; return 0; }