2763 | 2023-01-22 21:42:04 | KovácsHunor | Karácsonyi égők | cpp11 | Wrong answer 55/100 | 1.577s | 5928 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 main() {
cin >> n >> c;
for (int i = 0; i < n; i++) {
cin >> l[i];
}
for (int i = 0; i < n; i++) {
memset(used, 0, sizeof(used));
int cnt = 0;
for (int j = i; j < n; j++) {
if (!used[l[j]]) {
used[l[j]] = true;
cnt++;
}
if (cnt == c) {
ans = min(ans, j - i + 1);
break;
}
}
}
cout << ans << endl;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 2104 KiB | ||||
2 | Accepted | 2ms | 2372 KiB | ||||
subtask2 | 0/15 | ||||||
3 | Wrong answer | 19ms | 3144 KiB | ||||
4 | Wrong answer | 18ms | 3404 KiB | ||||
5 | Wrong answer | 18ms | 3680 KiB | ||||
6 | Accepted | 8ms | 2824 KiB | ||||
7 | Accepted | 8ms | 3076 KiB | ||||
subtask3 | 10/10 | ||||||
8 | Accepted | 2ms | 3016 KiB | ||||
9 | Accepted | 2ms | 3032 KiB | ||||
10 | Accepted | 2ms | 3304 KiB | ||||
11 | Accepted | 2ms | 3520 KiB | ||||
12 | Accepted | 2ms | 3444 KiB | ||||
subtask4 | 20/20 | ||||||
13 | Accepted | 4ms | 3636 KiB | ||||
14 | Accepted | 4ms | 3588 KiB | ||||
15 | Accepted | 4ms | 3848 KiB | ||||
16 | Accepted | 4ms | 4100 KiB | ||||
17 | Accepted | 4ms | 4304 KiB | ||||
subtask5 | 25/25 | ||||||
18 | Accepted | 48ms | 4528 KiB | ||||
19 | Accepted | 48ms | 4724 KiB | ||||
20 | Accepted | 45ms | 4776 KiB | ||||
21 | Accepted | 43ms | 4780 KiB | ||||
22 | Accepted | 39ms | 4984 KiB | ||||
subtask6 | 0/30 | ||||||
23 | Runtime error | 35ms | 5928 KiB | ||||
24 | Wrong answer | 26ms | 5792 KiB | ||||
25 | Wrong answer | 32ms | 5568 KiB | ||||
26 | Time limit exceeded | 1.56s | 4420 KiB | ||||
27 | Time limit exceeded | 1.577s | 4292 KiB | ||||
28 | Wrong answer | 37ms | 5580 KiB | ||||
29 | Wrong answer | 28ms | 5580 KiB | ||||
30 | Wrong answer | 19ms | 5840 KiB |