Submission #530256

# Submission time Handle Problem Language Result Execution time Memory
530256 2022-02-24T22:04:59 Z kderylo Martian DNA (BOI18_dna) C++17
100 / 100
37 ms 3908 KB
#include <iostream>
using namespace std;
const int stala=2e5+10;
int tab[stala];
int zapalone[stala];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int ile,rozmiar,ile_zapalonych;
    cin>>ile>>rozmiar>>ile_zapalonych;
    for(int i=1;i<=ile;i++)
    {
        cin>>tab[i];
    }
    for(int i=1;i<=ile_zapalonych;i++)
    {
        int podstawa,ilosc;
        cin>>podstawa>>ilosc;
        zapalone[podstawa]=ilosc;
    }
    int ind=0;
    int wyn=1e9;
    for(int i=1;i<=ile;i++)
    {
        while(ile_zapalonych>0&&ind<ile)
        {
            ind++;
            zapalone[tab[ind]]--;
            if(zapalone[tab[ind]]==0)
            {
                ile_zapalonych--;
            }
        }
        if(ile_zapalonych==0)
        {
            wyn=min(wyn,ind-i+1);
        }
        zapalone[tab[i]]++;
        if(zapalone[tab[i]]==1)
        {
            ile_zapalonych++;
        }
    }
    if(wyn==1e9)
    {
        cout<<"impossible";
    }
    else
    {
        cout<<wyn;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 296 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 0 ms 324 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 320 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1464 KB Output is correct
2 Correct 12 ms 1476 KB Output is correct
3 Correct 13 ms 1480 KB Output is correct
4 Correct 16 ms 1484 KB Output is correct
5 Correct 16 ms 2504 KB Output is correct
6 Correct 10 ms 1416 KB Output is correct
7 Correct 12 ms 1604 KB Output is correct
8 Correct 18 ms 3008 KB Output is correct
9 Correct 16 ms 2004 KB Output is correct
10 Correct 12 ms 1472 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 24 ms 3140 KB Output is correct
2 Correct 23 ms 2920 KB Output is correct
3 Correct 24 ms 2568 KB Output is correct
4 Correct 10 ms 1488 KB Output is correct
5 Correct 37 ms 3640 KB Output is correct
6 Correct 30 ms 3908 KB Output is correct
7 Correct 15 ms 2124 KB Output is correct
8 Correct 19 ms 2244 KB Output is correct
9 Correct 11 ms 1456 KB Output is correct
10 Correct 10 ms 1484 KB Output is correct
11 Correct 12 ms 1480 KB Output is correct
12 Correct 11 ms 1472 KB Output is correct
13 Correct 20 ms 2540 KB Output is correct
14 Correct 11 ms 1476 KB Output is correct
15 Correct 17 ms 1552 KB Output is correct
16 Correct 18 ms 3004 KB Output is correct
17 Correct 14 ms 1972 KB Output is correct
18 Correct 12 ms 1432 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 320 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 328 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 0 ms 320 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 1 ms 204 KB Output is correct
33 Correct 0 ms 204 KB Output is correct