Array V

PHOTO EMBED

Mon Oct 02 2023 06:32:11 GMT+0000 (Coordinated Universal Time)

Saved by @70da_vic2002

}

#include <iostream>

using namespace std;

int main()
{
    
    int N ,M ; 
    cin>>N,M ;  
    int X[N] ,B[100001]={0} ;
    for(int i=0 ;i<N ;i++){
        cin>>X[i] ; 
        B[X[i]]++ ; 
        
    } 
    for(int i=0 ;i<N ;i++){ 
        if(B[X[i]]==-1){
            continue ;
        } 
        cout<<B[X[i]]<<endl; 
        B[X[i]]=-1 ; 
    } 
    

    return 0;
}

content_copyCOPY

https://www.onlinegdb.com/online_c++_compiler