Submission #241069

# Submission time Handle Problem Language Result Execution time Memory
241069 2020-06-22T13:47:01 Z lakshith_ Rice Hub (IOI11_ricehub) C++14
17 / 100
1000 ms 1012 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;
    }
    MAX = max(MAX,Count);
  }
  return MAX;
}
# 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 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Incorrect 5 ms 128 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 1012 KB Time limit exceeded
2 Halted 0 ms 0 KB -