Task: | Taulukko |
Sender: | Narski |
Submission time: | 2018-10-14 23:26:43 +0300 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:12:5: error: 'unordered_set' was not declared in this scope unordered_set<long int> a; ^~~~~~~~~~~~~ input/code.cpp:12:19: error: expected primary-expression before 'long' unordered_set<long int> a; ^~~~ input/code.cpp:22:16: error: 'a' was not declared in this scope if(a.size()<=k) ^ input/code.cpp:43:9: error: 'a' was not declared in this scope a.clear(); ^
Code
#include <iostream>#include <set>using namespace std;int main(){long int n,k;cin >> n;cin >> k;long int t[n];unordered_set<long int> a;long int tulos = 0;for(long int i = 0;i<n;i++){cin >> t[i];}for(long int j = 0; j<n; j++){for(long int x = j; x<n ;x++){if(a.size()<=k){if(a.size() == k){a.insert(t[x]);if(a.size() == k){tulos++;}}else{tulos++;a.insert(t[x]);}}else{break;}}a.clear();}cout << tulos;return 0;}