Submission #1015777

#TimeUsernameProblemLanguageResultExecution timeMemory
1015777KasymKRice Hub (IOI11_ricehub)C++17
68 / 100
1058 ms900 KiB
#include "bits/stdc++.h" using namespace std; #define pb push_back #define ll long long #define ff first #define ss second #define all(v) v.begin(), v.end() int besthub(int r, int l, int x[], ll b){ ll b_ = b; int ans = 0; for(int k = 0; k < r; ++k){ vector<int> v; for(int i = 0; i < r; ++i) v.pb(abs(x[k]-x[i])); sort(all(v)); ll sm = 0; int cnt = 0; for(auto i : v){ sm += i; if(sm > b) break; cnt++; } ans = max(ans, cnt); } return ans; } // const int N = 20; // int a[N]; // int main(){ // int r, l; // ll b; // r = 5, l = 20, b = 6; // a[0] = 1, a[1] = 2, a[2] = 10, a[3] = 12, a[4] = 14; // printf("%d\n", besthub(r, l, a, b)); // return 0; // }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:10:8: warning: unused variable 'b_' [-Wunused-variable]
   10 |     ll b_ = 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...