Submission #241070

# Submission time Handle Problem Language Result Execution time Memory
241070 2020-06-22T13:51:39 Z lakshith_ Rice Hub (IOI11_ricehub) C++14
68 / 100
1000 ms 952 KB
#include <bits/stdc++.h>
#include "ricehub.h"
#define ll long long
#define pb push_back

using namespace std;

inline ll min(ll a,ll b){
  return a<b?a:b;
}

inline ll max(ll a,ll b){
  return a<b?b:a;
}

inline ll abs(ll a,ll b){
  return max(a,b)-min(a,b);
}

int besthub(int r,int l,int x[],ll b){
  int MAX = 0;
  for(int i=0;i<r;i++){
    vector<ll> vec;
    for(int j=0;j<r;j++){
      vec.pb(abs(x[i],x[j]));
    }
    sort(vec.begin(),vec.end());
    int Count = 0;
    ll cost = b;
    while(true){
      if(vec[Count]<=cost)
        cost -= vec[Count++];
      else 
        break;
      if(vec.size()==Count)break;
    }
    MAX = max(MAX,Count);
  }
  return MAX;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:35:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if(vec.size()==Count)break;
          ~~~~~~~~~~^~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 256 KB Output is correct
21 Correct 8 ms 384 KB Output is correct
22 Correct 8 ms 384 KB Output is correct
23 Correct 11 ms 384 KB Output is correct
24 Correct 11 ms 384 KB Output is correct
25 Correct 11 ms 384 KB Output is correct
26 Correct 11 ms 384 KB Output is correct
27 Correct 10 ms 384 KB Output is correct
28 Correct 10 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 27 ms 384 KB Output is correct
4 Correct 25 ms 384 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 9 ms 384 KB Output is correct
7 Correct 19 ms 384 KB Output is correct
8 Correct 19 ms 384 KB Output is correct
9 Correct 11 ms 384 KB Output is correct
10 Correct 10 ms 384 KB Output is correct
11 Correct 20 ms 384 KB Output is correct
12 Correct 21 ms 384 KB Output is correct
13 Correct 29 ms 384 KB Output is correct
14 Correct 31 ms 384 KB Output is correct
15 Correct 11 ms 384 KB Output is correct
16 Correct 10 ms 384 KB Output is correct
17 Correct 20 ms 384 KB Output is correct
18 Correct 20 ms 384 KB Output is correct
19 Correct 30 ms 384 KB Output is correct
20 Correct 32 ms 384 KB Output is correct
21 Correct 420 ms 516 KB Output is correct
22 Correct 412 ms 512 KB Output is correct
23 Correct 861 ms 632 KB Output is correct
24 Correct 874 ms 632 KB Output is correct
25 Correct 805 ms 632 KB Output is correct
26 Correct 793 ms 632 KB Output is correct
27 Correct 718 ms 636 KB Output is correct
28 Correct 719 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 952 KB Time limit exceeded
2 Halted 0 ms 0 KB -