fork download
  1.  
  2. #include <bits/stdc++.h>
  3. #define lli long long int
  4. using namespace std;
  5.  
  6. multimap<int , int> score;
  7. map<int , int> num;
  8.  
  9. void increase(int x)
  10. {
  11. map<int , int>::iterator num_it = num.find(x);
  12. if ( num_it == num.end() )
  13. {
  14. num[x] = 1;
  15. score.insert( make_pair( 1 , x ) );
  16. }
  17. else
  18. {
  19. score_it = (num_it->second);
  20. int cnt = score_it->first + 1;
  21. score.erase( score_it );
  22. num_it->second = score.insert( make_pair( cnt , x ) );
  23. }
  24. }
  25.  
  26. int getMin()
  27. {
  28. return score.begin()->second;
  29. }
  30.  
  31. int main()
  32. {
  33. ios_base::sync_with_stdio(false);
  34. int n , m;
  35.  
  36. cin>>n>>m;
  37. for (int i=0 ; i<n ; i++)
  38. {
  39. for (int j=0 ; j<m ; j++)
  40. {
  41. int x; cin>>x;
  42. increase(x);
  43. }
  44.  
  45. cout<<getMin()<<"\n";
  46. }
  47.  
  48. return 0;
  49. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void increase(int)':
prog.cpp:19:3: error: 'score_it' was not declared in this scope
   score_it = (num_it->second);
   ^
prog.cpp:22:18: error: cannot convert 'std::multimap<int, int>::iterator {aka std::_Rb_tree_iterator<std::pair<const int, int> >}' to 'int' in assignment
   num_it->second = score.insert( make_pair( cnt , x ) );
                  ^
stdout
Standard output is empty