Submission #887549

# Submission time Handle Problem Language Result Execution time Memory
887549 2023-12-14T18:10:10 Z salmon Self Study (JOI22_ho_t2) C++14
0 / 100
76 ms 4700 KB
#include <bits/stdc++.h>
using namespace std;

int N;
int M;
long long int A[300100];
long long int B[300100];
const long long int inf = 2e18;

int main(){
    scanf(" %d",&N);
    scanf(" %d",&M);

    for(int i = 0; i < N; i++){
        scanf(" %lld",&A[i]);
    }

    for(int i = 0; i < N; i++){
        scanf(" %lld",&B[i]);
    }

    long long int s = 0;
    long long int e = inf;

    while(s != e){
        long long int m = (s + e + 1)/2;

        long long int free = 0;

        for(int i = 0; i < N; i++){
            //if(B[i] > A[i]){
                free += M;
                free -= (m + B[i] - 1) / B[i];
            /*}
            else{
                if( (m + A[i] - 1)/A[i] >= M){
                    long long int v = max(0LL,m - A[i] * M);
                    free -= (v + B[i] - 1)/ B[i];
                }
                else{
                    free += M;
                    free -= (m + A[i] - 1)/A[i];
                }
            }*/
        }

        if(free >= 0){
            s = m;
        }
        else{
            e = m - 1;
        }
    }

    printf("%lld",s);
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf(" %d",&N);
      |     ~~~~~^~~~~~~~~~
Main.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf(" %d",&M);
      |     ~~~~~^~~~~~~~~~
Main.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf(" %lld",&A[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
Main.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         scanf(" %lld",&B[i]);
      |         ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 0 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2552 KB Output is correct
9 Correct 76 ms 4700 KB Output is correct
10 Correct 54 ms 4700 KB Output is correct
11 Correct 38 ms 4700 KB Output is correct
12 Correct 31 ms 4696 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Incorrect 5 ms 2396 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 0 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2552 KB Output is correct
9 Correct 76 ms 4700 KB Output is correct
10 Correct 54 ms 4700 KB Output is correct
11 Correct 38 ms 4700 KB Output is correct
12 Correct 31 ms 4696 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Incorrect 5 ms 2396 KB Output isn't correct
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 0 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -