Submission #1049054

#TimeUsernameProblemLanguageResultExecution timeMemory
1049054AndreasKRice Hub (IOI11_ricehub)C++14
0 / 100
21 ms4764 KiB
#include <bits/stdc++.h> using namespace std; #define designed ios_base::sync_with_stdio(0); #define by cin.tie(0); #define AndreasK cout.tie(0); #define ii pair <int,int> #define vi vector <int> #define iii pair <int,ii> #define vii vector <ii> #define vc vector <char> #define vb vector <bool> int besthub(int R, int L, int X[], long long B) { int x=X[R/2],y=X[R/2]; if (y%2==0) y=X[R/2-1]; vi a; vi b; for (int c=0;c<R;c++) a.push_back(abs(x-X[c])); for (int c=0;c<R;c++) b.push_back(abs(y-X[c])); sort(a.begin(),a.end()); sort(b.begin(),b.end()); int Ba=B,Bb=B; int p1=0,p2=0; for (int c=0;c<R;c++){ if (a[c]<=Ba){ Ba-=a[c]; p1++; } if (b[c]<=Bb){ Bb-=b[c]; p2++; } } return max(p1,p2); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...