Submission #772291

# Submission time Handle Problem Language Result Execution time Memory
772291 2023-07-03T22:14:22 Z Sputnik123 Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <string.h>
#include <stdio.h>
#define pb push_back
#define in insert
#define pll pair<ll,ll>
#define vpl vector<pll>
#define vl vector<ll>
#define sl set<ll>
#define msl multiset<ll>
#define mll map<ll,ll>
#define mmll multimap<ll,ll>
#define mcl map<char,ll>
#define mp make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define endl "\n"
#define speed ios_base::sync_with_stdio(false);cin.tie();cout.tie()
#define ll long long
#define ull unsigned long long
#define LMX LLONG_MAX
using namespace std;
#define REP(i, n) for (ll i=0;i<(n);i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i, 0, a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i, 0, a)
#define rep(a) F0R(_, a)
#define each(a, x) for (auto &a : x)
int main ()
{
   ll R,L;
   ll B;
   cin>>R>>L>>B;
   vector <ll> x (R+1);
   vector <ll> pref_sum(R+1);
   for(ll i=1;i<=R;i++)
      cin>>x[i];
   pref_sum[0]=0;
   for(ll i=1;i<=R;i++)
   {
      pref_sum[i]=pref_sum[i-1]+x[i];
   }
   ll res=0,i=1,j=1;
   while(j<=R)
   {
      ll o=(i+j)/2;
      ll cost=(o-i+1)*x[o]-(j-o)*x[o]-(pref_sum[o]-pref_sum[i-1])+(pref_sum[j]-pref_sum[o]);
      if(cost<=B)
      {
         res=max(res,j-i+1);
         j++;
      }
      else
      {
         i++;
      }
      
   }
   cout<<res<<endl;
}

Compilation message

/usr/bin/ld: /tmp/ccxAdchx.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccviqviw.o:ricehub.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccxAdchx.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status