116682024-11-04 17:54:17bzyKarácsonyi égőkcpp17Wrong answer 35/1001.588s3128 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll  long long

int main()
{
    int n, c; cin >> n >> c;
    vector <int> L(n+1);
    for(int i = 1; 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
1Accepted1ms320 KiB
2Accepted1ms320 KiB
subtask20/15
3Accepted37ms1080 KiB
4Wrong answer37ms1200 KiB
5Wrong answer37ms1080 KiB
6Accepted1ms320 KiB
7Wrong answer1ms320 KiB
subtask310/10
8Accepted1ms320 KiB
9Accepted1ms320 KiB
10Accepted2ms320 KiB
11Accepted1ms512 KiB
12Accepted1ms320 KiB
subtask40/20
13Accepted1ms336 KiB
14Accepted1ms320 KiB
15Wrong answer1ms320 KiB
16Accepted1ms508 KiB
17Accepted1ms320 KiB
subtask525/25
18Accepted79ms436 KiB
19Accepted4ms320 KiB
20Accepted4ms376 KiB
21Accepted2ms508 KiB
22Accepted2ms320 KiB
subtask60/30
23Time limit exceeded1.588s3128 KiB
24Accepted111ms1856 KiB
25Accepted280ms1848 KiB
26Time limit exceeded1.588s2360 KiB
27Time limit exceeded1.582s2616 KiB
28Accepted280ms1848 KiB
29Accepted145ms1828 KiB
30Accepted37ms1080 KiB