답안 #573014

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
573014 2022-06-05T16:06:43 Z groshi Self Study (JOI22_ho_t2) C++17
0 / 100
468 ms 11020 KB
#include<iostream>

using namespace std;
long long a[400000],b[400000];
long long n,m;
bool ok(long long ile)
{
    //cout<<"check "<<ile<<"\n";
    long long wolne=0;
    for(int i=1;i<=n;i++)
    {
        if(b[i]>a[i])
            a[i]=b[i];
        long long ile_kursow_ja=ile/a[i];
        if(ile%a[i]!=0)
            ile_kursow_ja++;
        if(ile_kursow_ja<=m)
            wolne+=(m-ile_kursow_ja);
        else{
            long long reszta=ile-m*a[i];
            long long dod=reszta/b[i];
            if(reszta%b[i]!=0)
                dod++;
            wolne-=dod;
        }
        //cout<<ile_kursow_ja<<" "<<wolne<<"\n";
    }

    if(wolne>=0)
        return 1;
    else return 0;
}
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    for(int i=1;i<=n;i++)
        cin>>b[i];
    long long pocz=0,kon=1e18+1,sre,ostd;
    while(pocz<kon)
    {
        sre=(pocz+kon)/2;
        //cout<<sre<<": "<<ok(sre)<<"\n";
        if(ok(sre))
        {
            ostd=sre;
            pocz=sre+1;
        }
        else kon=sre;
    }
    cout<<ostd;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Correct 233 ms 11020 KB Output is correct
12 Correct 232 ms 10820 KB Output is correct
13 Correct 233 ms 8780 KB Output is correct
14 Incorrect 468 ms 8828 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 432 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 119 ms 5572 KB Output is correct
10 Correct 78 ms 3856 KB Output is correct
11 Correct 58 ms 2936 KB Output is correct
12 Correct 50 ms 2424 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Incorrect 9 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Correct 233 ms 11020 KB Output is correct
12 Correct 232 ms 10820 KB Output is correct
13 Correct 233 ms 8780 KB Output is correct
14 Incorrect 468 ms 8828 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 432 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 119 ms 5572 KB Output is correct
10 Correct 78 ms 3856 KB Output is correct
11 Correct 58 ms 2936 KB Output is correct
12 Correct 50 ms 2424 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Incorrect 9 ms 340 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 260 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 4 ms 468 KB Output is correct
11 Correct 233 ms 11020 KB Output is correct
12 Correct 232 ms 10820 KB Output is correct
13 Correct 233 ms 8780 KB Output is correct
14 Incorrect 468 ms 8828 KB Output isn't correct
15 Halted 0 ms 0 KB -