CSES - Datatähti 2019 alku - Results
Submission details
Task:Taulukko
Sender:tanko
Submission time:2018-10-01 22:31:17 +0300
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp:1:1: error: stray '\377' in program
 ÿþ# i n c l u d e   < s e t > 
 
 ^
input/code.cpp:1:2: error: stray '\376' in program
 ÿþ# i n c l u d e   < s e t > 
 
  ^
input/code.cpp:1:3: error: stray '#' in program
 ÿþ# i n c l u d e   < s e t > 
 
   ^
input/code.cpp:1:4: warning: null character(s) ignored
 ÿþ# i n c l u d e   < s e t > 
 
    ^
input/code.cpp:1:6: warning: null character(s) ignored
 ÿþ# i n c l u d e   < s e t > 
 
      ^
input/code.cpp:1:8: warning: null character(s) ignored
 ÿþ# i n c l u d e   < s e t > 
 
        ^
input/code.cpp:1:10: warning: null character(s) ignored
 ÿþ# i n c l u d e   < s e t > 
 
          ^
input/code.cpp:1:12: warning: null character(s) ignored
 ÿþ# i n c l u d e   < s e t > 
 
            ^
input/code.cpp:1:14: warning: null character(s) ignored
 ÿþ# i n c l u d e   < s e t > 
 
              ^
input/code.cpp:1:16: warning: null character(s) ignored
 ÿþ# i n c l u d e   < s e t > 
 
                ^
input/code.cpp:1:18: warn...

Code

ÿþ#include <set>

#include <iostream>



int main()

{

	int n, k;



	std::cin >> n >> k;



	int *table = new int[n];

	for (int i = 0; i < n; ++i)

		std::cin >> table[i];



	int ans = 0;

	for (int i = 0; i < n; ++i) {

		std::set<int> curr;

		for (int j = 0; j < n - i; ++j) {

			curr.insert(table[i + j]);

			if (curr.size() > k)

				break;

			++ans;

		}

	}



	std::cout << ans << std::endl;



	system("pause");



    return 0;

}