# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
887558 | salmon | Self Study (JOI22_ho_t2) | C++14 | 286 ms | 11092 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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];
}
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 < (-M * N) ){
break;
}
}
if(free >= 0){
s = m;
}
else{
e = m - 1;
}
}
printf("%lld",s);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |