Submission #3984221


Source Code Expand

Copy
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
  int N, A, B;
  cin >> N >> A >> B;
  int c[] = {0,0,0};
  for(int i = 0; i < N; ++i){
    int p;
    cin >> p;
    if(p <= A) ++c[0];
    else if(p <= B) ++c[1];
    else ++c[2];
  }
  cout << min({c[0],c[1],c[2]}) << endl;
}

Submission Info

Submission Time
Task B - Contests
User TAB
Language C++ (GCC 5.4.1)
Score 0
Code Size 320 Byte
Status

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:16:15: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
   cout << min({c[0],c[1],c[2]}) << endl;
               ^
./Main.cpp:16:31: error: no matching function for call to ‘min(<brace-enclosed initializer list>)’
   cout << min({c[0],c[1],c[2]}) << endl;
                               ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/ostream:38,
                 from /usr/include/c++/5/iostream:39,
                 from ./Main.cpp:1:
/usr/include/c++/5/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/5/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
./Main.cpp:16:31: note:   candidate expects 2 arguments, 1 provided
   cout << min({c[0],c[1],c[2]}) << endl;
   ...