Submission #820105

#TimeUsernameProblemLanguageResultExecution timeMemory
820105nemethmRice Hub (IOI11_ricehub)C++17
0 / 100
1072 ms3152 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; using ll = long long int; int besthub(int R, int L, int X[], long long B) { int ans = 0; for(int i = 0; i < R; ++i){ vector<int> q; for(int j = 0; j < R; ++j){ q.push_back(abs(X[i] - X[j])); } ll cost = 0; int actual = 0; int j = 0; while(j < q.size() && cost + q[j] <= B){ ++actual; cost += q[j]; ++j; } ans = max(ans, actual); } return ans; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:19:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         while(j < q.size() && cost + q[j] <= B){
      |               ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...