Submission #655211

# Submission time Handle Problem Language Result Execution time Memory
655211 2022-11-03T14:44:43 Z AntonisPapaev Rice Hub (IOI11_ricehub) C++17
42 / 100
1000 ms 852 KB
#include<iostream>
#include<cmath>
#include<algorithm>
#include<utility>
#include<vector>
#include "ricehub.h"

int besthub(int R, int L, int X[], long long B)
{
    std::pair<long long,long long> ans{0,-1};
    std::vector<long long> p;
for(int i=0;i<L;i++) {
        p.clear();
    long long cnt=0,check=0;
        for (int j=0;j<R;j++)
        p.push_back(abs(i-X[j]));

        std::sort(p.begin(),p.end());

        for (int k=0;k<p.size();k++)
        if (check+p[k]<=B) {
        check+=p[k];
        cnt++; }
        else
            break;

        if (cnt>=ans.first)
            ans={cnt,i};
}
  return ans.first;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for (int k=0;k<p.size();k++)
      |                      ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 220 KB Output is correct
2 Correct 1 ms 216 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 2 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 2 ms 212 KB Output is correct
16 Correct 2 ms 312 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 2 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 10 ms 212 KB Output is correct
22 Correct 6 ms 308 KB Output is correct
23 Correct 86 ms 312 KB Output is correct
24 Correct 121 ms 212 KB Output is correct
25 Correct 87 ms 300 KB Output is correct
26 Correct 85 ms 304 KB Output is correct
27 Correct 69 ms 300 KB Output is correct
28 Correct 70 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 316 KB Output is correct
2 Correct 19 ms 212 KB Output is correct
3 Execution timed out 1084 ms 216 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 852 KB Time limit exceeded
2 Halted 0 ms 0 KB -