Submission #1049054

# Submission time Handle Problem Language Result Execution time Memory
1049054 2024-08-08T12:40:21 Z AndreasK Rice Hub (IOI11_ricehub) C++14
0 / 100
21 ms 4764 KB
#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 time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 448 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 452 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Incorrect 0 ms 348 KB Output isn't correct
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 448 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 448 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 1 ms 448 KB Output is correct
12 Correct 0 ms 448 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Incorrect 0 ms 348 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 860 KB Output is correct
2 Correct 3 ms 860 KB Output is correct
3 Incorrect 21 ms 4764 KB Output isn't correct
4 Halted 0 ms 0 KB -