# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
737211 | 2023-05-06T21:28:22 Z | ETheBest3 | 쌀 창고 (IOI11_ricehub) | C++17 | 16 ms | 1472 KB |
#include "ricehub.h" #define lli long long const lli MAXN=100005; lli pref[MAXN]; int besthub(int R, int L, int X[], long long B) { for(lli i=0; i<R; i++) { if(i==0)pref[i]=X[i]; else pref[i]=pref[i-1]+X[i]; } lli p1=0, p2=0, p3=0, now=0, sum=0, ans=0; for(; p2<R; p2++) { if((pref[p2])%(p2+1)>(p2+1)/2)now=(pref[p2])/(p2+1)+1; else now=now=(pref[p2])/(p2+1); while(p3<p2 and X[p3+1]<=now)p3++; sum=(pref[p2]-pref[p3])-now*(p2-p3)+now*(p3+1)-pref[p3]; //std::cout<<p3<<" "<<p2<<" "<<sum<<" "<<now<<std::endl; if(sum>B)break; } if(sum<=B)return p2; ans=p2; p2--; //std::cout<<p3<<" "<<p2<<" "<<sum<<" "<<ans<<std::endl; for(p1=0; p1<R; p1++) { if(p2<p1+1)p2=p1+1; for(; p2<R; p2++) { if((pref[p2]-pref[p1])%(p2-p1)>(p2-p1)/2)now=(pref[p2]-pref[p1])/(p2-p1)+1; else now=now=(pref[p2]-pref[p1])/(p2-p1); //std::cout<<now<<"\n"; while(p3<p2 and X[p3+1]<=now)p3++; sum=(pref[p2]-pref[p3])-now*(p2-p3)+now*(p3-p1)-(pref[p3]-pref[p1]); //std::cout<<p2<<" "<<p3<<" "<<p1<<" "<<sum<<"\n"; if(sum>B)break; } if(ans<p2-p1-1)ans=p2-p1-1; //std::cout<<p1<<" "<<p2<<" "<<ans<<std::endl; p2--; } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 0 ms | 212 KB | Output is correct |
24 | Correct | 0 ms | 212 KB | Output is correct |
25 | Correct | 0 ms | 212 KB | Output is correct |
26 | Correct | 0 ms | 212 KB | Output is correct |
27 | Incorrect | 0 ms | 212 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 1 ms | 340 KB | Output is correct |
22 | Correct | 1 ms | 340 KB | Output is correct |
23 | Correct | 1 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 340 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 2 ms | 340 KB | Output is correct |
27 | Incorrect | 2 ms | 340 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 444 KB | Output is correct |
2 | Correct | 3 ms | 468 KB | Output is correct |
3 | Correct | 14 ms | 1456 KB | Output is correct |
4 | Correct | 15 ms | 1364 KB | Output is correct |
5 | Correct | 7 ms | 876 KB | Output is correct |
6 | Correct | 7 ms | 852 KB | Output is correct |
7 | Correct | 14 ms | 1344 KB | Output is correct |
8 | Correct | 12 ms | 1472 KB | Output is correct |
9 | Correct | 7 ms | 852 KB | Output is correct |
10 | Correct | 7 ms | 852 KB | Output is correct |
11 | Correct | 13 ms | 1364 KB | Output is correct |
12 | Correct | 16 ms | 1460 KB | Output is correct |
13 | Incorrect | 7 ms | 864 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |