Submission #1027777

#TimeUsernameProblemLanguageResultExecution timeMemory
1027777vjudge1Rice Hub (IOI11_ricehub)C++17
42 / 100
1050 ms1372 KiB
#include <bits/stdc++.h> using namespace std; int besthub(int n, int l, int x[], long long b) { long long max_rez=-1, sol=1; for(int i=0; i<n; i++) { multiset<int>s; for(int j=0; j<n; j++) { s.insert(abs(x[j]-x[i])); } long long sum=0, rez=0; for(auto it=s.begin(); it!=s.end(); it++) { sum+=(*it); if(sum>b) { break; } rez++; } if(max_rez<rez) { max_rez=rez; sol=x[i]; } } return max_rez; } /*int main() { int r, l; long long b; cin>>r>>l; int x[r]; for(int i=0; i<r; i++) cin>>x[i]; cin>>b; cout<<besthub(r, l, x, b); return 0; }*/

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:5:27: warning: variable 'sol' set but not used [-Wunused-but-set-variable]
    5 |     long long max_rez=-1, sol=1;
      |                           ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...