Submission #224656

#TimeUsernameProblemLanguageResultExecution timeMemory
224656jhtanRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include "ricehub.h" #include "bits/stdc++.h" using namespace std; int besthub(int R, int L, int X[], long long B) { int mn = 2000000001; int sol = 0; for(int i=1; i<=L; i++) { int s = 0, c = 0; vector<int> V; for(int j=0; j<X.length(); j++) V.push_back(abs(i-X[j])); sort(V.begin(), V.end()); for(int j=0; j<V.length(); j++) { if(s + V[j] <= B) {s += V[j]; c++;} else break; } if(s < mn) { mn = s; sol = c; } } return sol; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:14:22: error: request for member 'length' in 'X', which is of non-class type 'int*'
     for(int j=0; j<X.length(); j++) V.push_back(abs(i-X[j]));
                      ^~~~~~
ricehub.cpp:17:22: error: 'class std::vector<int>' has no member named 'length'
     for(int j=0; j<V.length(); j++) {
                      ^~~~~~