Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- long long int n,m,tab[1000000],tab2[1000000],a,b,c,d;
- cin>>n>>m;
- if(n>=1 and n<=1000000 and m>=1000000 and m<=1)
- {
- for(int i=0;i<n;i++)
- {
- cin>>a;
- tab[i]=a;
- }
- for(int j=0;j<n;j++)
- {
- for(int k=j;k<n;k++)
- {
- for(int h=b;h<k;h++)
- {
- b++;
- for(int o=m;o>=1;o--)
- {
- if(tab[h]==o)
- {
- tab2[o]++;
- }
- }
- }
- c++;
- b=c;
- for(int l=1;l<=m;l++)
- {
- if(tab2[l]>2)
- {
- break;
- }
- else
- {
- d++;
- }
- cout<<d<<endl;
- }
- for(int s=0;s<1000000;s++)
- {
- tab[s]=0;
- }
- }
- b=0;
- }
- cout<<d;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement