mhdew

CF_961 A

Apr 4th, 2018
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int flag[10000];
  5.  
  6. int main()
  7. {
  8.     vector<int>v[10001];
  9.     int n, m;
  10.     int temp=0, ans=0;
  11.     int a[10001];
  12.     cin>>n>>m;
  13.     for(int i=0;i<m;i++){
  14.         temp=0;
  15.         cin>>a[i];
  16.         flag[a[i]]++;
  17.         for(int j=1;j<=n;j++){
  18.             if(flag[j]==0){
  19.                 temp=1;
  20.                 break;
  21.             }
  22.         }
  23.         if(temp==0){
  24.             ans++;
  25.             for(int j=1;j<=n;j++){
  26.                 flag[j]--;
  27.             }
  28.         }
  29.     }
  30.     cout<<ans<<endl;
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment