Submission #224668

#TimeUsernameProblemLanguageResultExecution timeMemory
224668Amy313Rice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include "ricehub.h" #include<bits/stdc++.h> int besthub(int R, int L, int X[], long long B) { int maxi= 0, c, a; long long cp = B; vector<int>V; for(int i=1; i<=L; i++) { c = 0; cp = B; for(int j=0; j<R; j++) { a = abs(i-X[j]); V.push_back(a); } sort(V.begin(), V.end()); for(int i=0; i<V.size; i++) { if(V[j]<=cp) { cp-=V[j]; c++; } else { break; } } if(c>maxi) { maxi = c; } } return maxi; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:7:2: error: 'vector' was not declared in this scope
  vector<int>V;
  ^~~~~~
ricehub.cpp:7:2: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from ricehub.cpp:2:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
ricehub.cpp:7:9: error: expected primary-expression before 'int'
  vector<int>V;
         ^~~
ricehub.cpp:15:4: error: 'V' was not declared in this scope
    V.push_back(a);
    ^
ricehub.cpp:17:8: error: 'V' was not declared in this scope
   sort(V.begin(), V.end());
        ^
ricehub.cpp:17:3: error: 'sort' was not declared in this scope
   sort(V.begin(), V.end());
   ^~~~
ricehub.cpp:17:3: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from ricehub.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:4856:5: note:   'std::sort'
     sort(_RandomAccessIterator __first, _RandomAccessIterator __last,
     ^~~~
ricehub.cpp:20:9: error: 'j' was not declared in this scope
    if(V[j]<=cp)
         ^