Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int flag[10000];
- int main()
- {
- vector<int>v[10001];
- int n, m;
- int temp=0, ans=0;
- int a[10001];
- cin>>n>>m;
- for(int i=0;i<m;i++){
- temp=0;
- cin>>a[i];
- flag[a[i]]++;
- for(int j=1;j<=n;j++){
- if(flag[j]==0){
- temp=1;
- break;
- }
- }
- if(temp==0){
- ans++;
- for(int j=1;j<=n;j++){
- flag[j]--;
- }
- }
- }
- cout<<ans<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment