Submission
Status:
[P][P][P][P][P][TSSSS]
Subtask/Task Score:
{17/17}{17/17}{17/17}{17/17}{17/17}{0/17}
Score: 85
User: APNICHANAN
Problemset: ละลานตา
Language: cpp
Time: 1.091 second
Submitted On: 2025-12-28 10:36:40
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, k, sum = 0;
cin >> n >> k;
set<int> now;
vector<int> s;
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
s.push_back(x);
}
for (int i = 0; i < n; i++)
{
if (n - i < k)
continue;
for (int j = i; j < n; j++)
{
now.insert(s[j]);
if ((int)now.size() >= k)
{
sum += n - j;
break;
}
}
now.clear();
}
cout << sum << endl;
}