2764 | 2023-01-22 21:43:08 | KovácsHunor | Karácsonyi égők | cpp11 | Wrong answer 0/100 | 35ms | 5172 KiB |
#include <iostream>
#include <cstring>
using namespace std;
const int MAX_N = 100000;
int n, c;
int l[MAX_N];
bool used[MAX_N];
int ans = MAX_N;
int cnt = 0;
int start = 0;
int main() {
cin >> n >> c;
for (int i = 0; i < n; i++) {
cin >> l[i];
}
for (int end = 0; end < n; end++) {
if (!used[l[end]]) {
used[l[end]] = true;
cnt++;
}
while (cnt == c) {
ans = min(ans, end - start + 1);
used[l[start]] = false;
cnt--;
start++;
}
}
cout << ans << endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Wrong answer | 3ms | 1760 KiB | ||||
2 | Wrong answer | 2ms | 1920 KiB | ||||
subtask2 | 0/15 | ||||||
3 | Wrong answer | 19ms | 2764 KiB | ||||
4 | Wrong answer | 18ms | 2892 KiB | ||||
5 | Wrong answer | 18ms | 3000 KiB | ||||
6 | Wrong answer | 2ms | 2356 KiB | ||||
7 | Wrong answer | 2ms | 2532 KiB | ||||
subtask3 | 0/10 | ||||||
8 | Accepted | 2ms | 2776 KiB | ||||
9 | Wrong answer | 2ms | 2972 KiB | ||||
10 | Wrong answer | 2ms | 3172 KiB | ||||
11 | Wrong answer | 2ms | 3380 KiB | ||||
12 | Wrong answer | 2ms | 3488 KiB | ||||
subtask4 | 0/20 | ||||||
13 | Wrong answer | 2ms | 3568 KiB | ||||
14 | Wrong answer | 2ms | 3564 KiB | ||||
15 | Wrong answer | 2ms | 3428 KiB | ||||
16 | Accepted | 2ms | 3560 KiB | ||||
17 | Wrong answer | 2ms | 3660 KiB | ||||
subtask5 | 0/25 | ||||||
18 | Accepted | 3ms | 3676 KiB | ||||
19 | Wrong answer | 3ms | 3668 KiB | ||||
20 | Wrong answer | 3ms | 3796 KiB | ||||
21 | Wrong answer | 3ms | 3872 KiB | ||||
22 | Wrong answer | 3ms | 4024 KiB | ||||
subtask6 | 0/30 | ||||||
23 | Runtime error | 35ms | 5172 KiB | ||||
24 | Wrong answer | 26ms | 4916 KiB | ||||
25 | Wrong answer | 28ms | 4916 KiB | ||||
26 | Wrong answer | 34ms | 4872 KiB | ||||
27 | Wrong answer | 35ms | 4976 KiB | ||||
28 | Wrong answer | 28ms | 4880 KiB | ||||
29 | Wrong answer | 26ms | 4884 KiB | ||||
30 | Wrong answer | 18ms | 4828 KiB |