Cod sursa(job #3123960)

Utilizator Mihai780Mihai Neagoe Mihai780 Data 26 aprilie 2023 14:36:47
Problema Secventa 5 Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.75 kb
#include <bits/stdc++.h>
using namespace std;

ifstream fin("secv5.in");
ofstream fout("secv5.out");

int N,L,U,v[10000000],S,nr,n;
vector<int> elemente;
int main()
{
    fin>>N>>L>>U;
    for(int i=0; i<N ;i++)
    {
        fin>>v[i];
    }
    for(int i=0 ; i<N ;i++)
    {
        elemente.clear();
        elemente.push_back(v[i]);
        S=1;
        if(S<=U && S>=L)
            {
               nr++;
            }
        for(int j=i+1 ;j<N;j++)
        {
            if (count(elemente.begin(), elemente.end(), v[j])==0)
            {
                S++;
            }
            elemente.push_back(v[j]);
            if(S<=U && S>=L)
            {
               nr++;
            }
        }
    }
    fout<<nr;
}