116692024-11-04 17:56:39bzyKarácsonyi égőkcpp17Time limit exceeded 70/1001.582s1848 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll  long long

int main()
{
    int n, c; cin >> n >> c;
    vector <int> L(n);
    for(int i = 0; i < n; i++) cin >> L[i];
    vector <int> A(c, 0);
    int ans = n;
    int l = 0, r = 0;
    while(r < n){
        A[L[r]]++;
        while(!count(A.begin(), A.end(), 0)){
            ans = min(ans, r - l + 1);
            A[L[l]]--;
            l++;
        }
        r++;
    }

    cout << ans;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms508 KiB
2Accepted1ms320 KiB
subtask215/15
3Accepted37ms1084 KiB
4Accepted37ms1196 KiB
5Accepted37ms1192 KiB
6Accepted1ms320 KiB
7Accepted1ms320 KiB
subtask310/10
8Accepted1ms756 KiB
9Accepted1ms320 KiB
10Accepted1ms320 KiB
11Accepted1ms508 KiB
12Accepted1ms320 KiB
subtask420/20
13Accepted1ms320 KiB
14Accepted1ms320 KiB
15Accepted1ms320 KiB
16Accepted1ms320 KiB
17Accepted1ms320 KiB
subtask525/25
18Accepted79ms444 KiB
19Accepted4ms420 KiB
20Accepted4ms424 KiB
21Accepted2ms424 KiB
22Accepted2ms320 KiB
subtask60/30
23Time limit exceeded1.582s1848 KiB
24Accepted108ms1080 KiB
25Accepted282ms1080 KiB
26Time limit exceeded1.582s1336 KiB
27Time limit exceeded1.569s1604 KiB
28Accepted280ms1080 KiB
29Accepted144ms1080 KiB
30Accepted37ms1080 KiB