답안 #772290

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
772290 2023-07-03T22:12:39 Z Sputnik123 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
#pragma comment(linker, "/STACK:100000000")
#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)
/*
#pragma omp parallel for 
#pragma GCC optimize("0fast")
#pragma GCC target ("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
*/
/*
#define N 2001
vector <vector <ll>> edge(2001,vector <ll> (2001));
vector <ll> color (2001);
//memset(color,0,sizeof(color));
vector <vector <ll>> heyvanlar(2001 ,vector <ll> (2001));
bool colorable;
ll n;
void coloring_graph(ll edge1,ll reng)
{
   color[edge1]=reng;
   for(ll i=0;i<heyvanlar[edge1].size();i++)
   {
      if(color[i]==0)
      {
         coloring_graph(i,3-reng);
      }
      else if(color[i]==color[edge1])
      {
         colorable=false;
      }
   }
}
bool renglene_bilir_mi()
{
   for(ll i=0;i<N;i++)
   {
      color[i]=0;
   }
   colorable=true;
   for(ll i=0;i<n;i++)
   {
      if(color[i]==0)
      {
         coloring_graph(i,1);
      }
   }
   return colorable;
}
/*void solve()
{
   string n;
   cin>>n;
   ll hasil;
   if(n[0]=='0' and n.length()==1)
   {
      cout<<0<<endl;
      return ;
   }
   if(n[0]=='?')  hasil=1;
   else  hasil=9;
   for(ll i=1;i<n.length();i++)
   {
      if(n[i]=='?')
      {
         hasil=10;
      }
   }
   cout<<hasil<<endl;
}
void cayi_kecmek()
{
   
   
   cin>>n;
   for(ll i=0;i<n;i++)
   {
      ll t;
      cin>>t;
      while(t--)
      {
         ll a;
         cin>>a;
         heyvanlar[i].pb(a);
         heyvanlar[a].pb(i);
      }
   }
   if(n<=4)
   {
      cout<<":)";
      return ;
   }
   else if(renglene_bilir_mi())
   {
      cout<<":)";
   }
   else
   {
      cout<<":(";
   }
}
*/
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

ricehub.cpp:1: warning: ignoring '#pragma comment ' [-Wunknown-pragmas]
    1 | #pragma comment(linker, "/STACK:100000000")
      | 
ricehub.cpp:77:1: warning: "/*" within comment [-Wcomment]
   77 | /*void solve()
      |  
/usr/bin/ld: /tmp/ccvcXsHp.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9ZxXOq.o:ricehub.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccvcXsHp.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