제출 #28925

#제출 시각아이디문제언어결과실행 시간메모리
28925aybala쌀 창고 (IOI11_ricehub)C++11
42 / 100
16 ms6316 KiB
#include "ricehub.h" #include<bits/stdc++.h> #define fori(a,b,c) for(a=b;a<c;a++) #define ford(a,b,c) for(a=b;a>=c;a--) #define pb push_back #define pii pair<int,int> #define mii map<int,int> #define mp make_pair #define pcc pair<char,char> #define ll long long #define pll pair<long long,long long> #define fi first #define se second #define pss pair<short, short> #define pq priority_queue using namespace std; int sum[100004]; int besthub(int R, int L, int X[], long long B) { int l,r; sum[0]=X[0]; int i,j,k; fori(i,1,R){ sum[i]+=sum[i-1]+X[i]; } int ans=0; r=0; fori(l,0,R){ while(r<R){ int mid=(l+r)/2; ll b=0; b+=(long long)X[mid]*(mid-l); if(mid) b-=sum[mid-1]; if(l) b+=sum[l-1]; b+=(long long)sum[r]-sum[mid]-(long long)X[mid]*(r-mid); if(b>B) break; r++; } ans=max(ans,r-l); } R=ans; return R; }

컴파일 시 표준 에러 (stderr) 메시지

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:24:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j,k;
        ^
ricehub.cpp:24:10: warning: unused variable 'k' [-Wunused-variable]
  int i,j,k;
          ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...