Submission #112972

#TimeUsernameProblemLanguageResultExecution timeMemory
112972CaroLindaRice Hub (IOI11_ricehub)C++14
68 / 100
1078 ms848 KiB
#include <bits/stdc++.h> #include "ricehub.h" #define lp(i,a,b) for(int i = a ; i < b ; i++ ) #define pii pair<int,int> #define ff first #define ss second #define mk make_pair #define pb push_back #define ll long long const int MAXN = 5005 ; const int inf = 1e9 + 10 ; using namespace std ; //Declarations int r , l ; ll b ; int x[MAXN] ; int test(int k) { int ans = 0 ; vector<int> d ; lp(i,0,r) d.pb( abs( x[k] - x[i] ) ) ; sort( d.begin() , d.end() ) ; int ind = 0 , B = b ; while( ind < d.size() ) { if( B - d[ind] >= 0 ) ans++ , B -= d[ind++] ; else break ; } return ans ; } int besthub(int R , int L , int X[] , ll B) { //Make them global r = R ; l = L ; b = B ; lp(i,0,R) x[i] = X[i] ; sort( x , x+R ) ; int ans = -inf ; lp(i,0,r) ans = max(ans , test(i) ) ; return ans ; }

Compilation message (stderr)

ricehub.cpp: In function 'int test(int)':
ricehub.cpp:35:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while( ind < d.size() )
         ~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...