# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
887555 | 2023-12-14T18:25:35 Z | salmon | Self Study (JOI22_ho_t2) | C++14 | 216 ms | 11556 KB |
#include <bits/stdc++.h> using namespace std; int N; long long int M; long long int A[300100]; long long int B[300100]; const long long int inf = 1.5e18; int main(){ scanf(" %d",&N); scanf(" %lld",&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]; if(free < (-M * N) ){ break; } /*} 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2492 KB | Output is correct |
7 | Correct | 0 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 51 ms | 7244 KB | Output is correct |
10 | Correct | 31 ms | 6516 KB | Output is correct |
11 | Correct | 23 ms | 5980 KB | Output is correct |
12 | Correct | 20 ms | 5880 KB | Output is correct |
13 | Correct | 1 ms | 2396 KB | Output is correct |
14 | Correct | 1 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 | Correct | 2 ms | 2396 KB | Output is correct |
19 | Correct | 2 ms | 2396 KB | Output is correct |
20 | Correct | 1 ms | 2496 KB | Output is correct |
21 | Correct | 48 ms | 6176 KB | Output is correct |
22 | Correct | 98 ms | 11556 KB | Output is correct |
23 | Correct | 89 ms | 10908 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 1 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Correct | 1 ms | 2492 KB | Output is correct |
7 | Correct | 0 ms | 2396 KB | Output is correct |
8 | Correct | 1 ms | 2396 KB | Output is correct |
9 | Correct | 51 ms | 7244 KB | Output is correct |
10 | Correct | 31 ms | 6516 KB | Output is correct |
11 | Correct | 23 ms | 5980 KB | Output is correct |
12 | Correct | 20 ms | 5880 KB | Output is correct |
13 | Correct | 1 ms | 2396 KB | Output is correct |
14 | Correct | 1 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 | Correct | 2 ms | 2396 KB | Output is correct |
19 | Correct | 2 ms | 2396 KB | Output is correct |
20 | Correct | 1 ms | 2496 KB | Output is correct |
21 | Correct | 48 ms | 6176 KB | Output is correct |
22 | Correct | 98 ms | 11556 KB | Output is correct |
23 | Correct | 89 ms | 10908 KB | Output is correct |
24 | Correct | 28 ms | 5468 KB | Output is correct |
25 | Correct | 77 ms | 7296 KB | Output is correct |
26 | Correct | 12 ms | 5212 KB | Output is correct |
27 | Correct | 93 ms | 10908 KB | Output is correct |
28 | Correct | 98 ms | 11172 KB | Output is correct |
29 | Correct | 95 ms | 10832 KB | Output is correct |
30 | Correct | 114 ms | 10916 KB | Output is correct |
31 | Correct | 195 ms | 10832 KB | Output is correct |
32 | Correct | 129 ms | 6088 KB | Output is correct |
33 | Correct | 216 ms | 11360 KB | Output is correct |
34 | Correct | 126 ms | 6224 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2396 KB | Output is correct |
2 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |