Submission #109876

# Submission time Handle Problem Language Result Execution time Memory
109876 2019-05-08T08:45:40 Z Nucleist Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 476 KB
#include <bits/stdc++.h> 
using namespace std; 
#define flash ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ll long long
#define INF 1000000000
#define pb push_back
struct greateri
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};
ll besthub(int r,int l,int x[],ll b)
{
  //flash;
  
  ll glob = 0;
  ll ans=0;
  for (ll i = 0; i < r; ++i)
  {
    for (ll j = i+1; j < r; ++j)
    {
      ll med = (x[j]+x[i])/2;
      ll ans = 0;
      for (ll s = i; s <= j; ++s)
      {
        ans+=abs(x[s]-med);
      }
      //debug(ans);
      //debugs(i,j);
      if(ans<=b)
        glob=max(glob,j-i+1);
    }
  }
  return glob;
}

Compilation message

ricehub.cpp: In function 'long long int besthub(int, int, int*, long long int)':
ricehub.cpp:21:6: warning: unused variable 'ans' [-Wunused-variable]
   ll ans=0;
      ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 170 ms 476 KB Output is correct
4 Correct 127 ms 384 KB Output is correct
5 Incorrect 28 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -