답안 #533601

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533601 2022-03-06T15:05:54 Z groshi 쌀 창고 (IOI11_ricehub) C++17
100 / 100
17 ms 3276 KB
#include<iostream>
#include "ricehub.h"
using namespace std;
long long prefixy[100100];
long long mam[100100];
long long oblicz(int x,int y)
{
    int srodek=(x+y)/2;
    long long wynik_pomoc=mam[srodek]*(srodek-x)-(prefixy[srodek-1]-prefixy[x-1]);
    long long wynik_pom=(prefixy[y]-prefixy[srodek])-mam[srodek]*(y-srodek);
    return wynik_pomoc+wynik_pom;
}
int besthub(int n,int l,int tak[],long long b)
{
    long long wynik=0,j=1,wynik_pom;
    for(int i=0;i<n;i++)
        mam[i+1]=tak[i];
    for(int i=1;i<=n;i++)
    {
        prefixy[i]=prefixy[i-1];
        prefixy[i]+=mam[i];
    }
    for(int i=1;i<=n;i++)
    {
        wynik_pom=oblicz(i,j+1);
        while(j<n && wynik_pom<=b)
        {
            j++;
            wynik_pom=oblicz(i,j+1);
        }
        if((j-i+1)>wynik)
            wynik=(j-i+1);
    }
    return wynik;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 236 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 308 KB Output is correct
20 Correct 0 ms 308 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 0 ms 332 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 304 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 444 KB Output is correct
22 Correct 1 ms 316 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 792 KB Output is correct
2 Correct 3 ms 716 KB Output is correct
3 Correct 17 ms 3276 KB Output is correct
4 Correct 13 ms 3232 KB Output is correct
5 Correct 6 ms 1544 KB Output is correct
6 Correct 6 ms 1592 KB Output is correct
7 Correct 12 ms 2956 KB Output is correct
8 Correct 11 ms 2892 KB Output is correct
9 Correct 5 ms 1548 KB Output is correct
10 Correct 6 ms 1484 KB Output is correct
11 Correct 15 ms 3252 KB Output is correct
12 Correct 13 ms 3252 KB Output is correct
13 Correct 6 ms 1732 KB Output is correct
14 Correct 6 ms 1580 KB Output is correct
15 Correct 10 ms 2516 KB Output is correct
16 Correct 10 ms 2516 KB Output is correct
17 Correct 12 ms 2884 KB Output is correct
18 Correct 11 ms 2916 KB Output is correct
19 Correct 12 ms 3140 KB Output is correct
20 Correct 12 ms 3036 KB Output is correct