# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
842755 | 2023-09-03T10:53:25 Z | _Avocado_ | Self Study (JOI22_ho_t2) | C++14 | 61 ms | 10520 KB |
#include <bits/stdc++.h> #define int int64_t using namespace std; int n, m; int up(int a, int b){ int ret = a/b; if(a%b) ++ret; return ret; } int check(int x, auto&a, auto&b){ int extra = 0; for(int i = 0; i<n; ++i){ int days = up(x, a[i]); if(days <= m) extra -= (m-days); else{ int rest = x - (m*a[i]); int extra_days = up(rest, b[i]); extra += extra_days; } } if(extra <= 0) return 1; return 0; } int bsearch(auto&a, auto&b){ int l = -1; int r = 1e18+18; while(r-l > 1){ int x = (r+l)/2; if(check(x, a, b)) l = x; else r = x; } return l; } signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("input.in", "r", stdin); //freopen("output.out", "w", stdout); cin>>n>>m; vector<int>a(n); for(auto&u: a) cin>>u; vector<int>b(n); for(auto&u: b) cin>>u; /* for(int i = 0; i<n; ++i){ if(a[i] < b[i]) a[i] = b[i]; } cout<<bsearch(a, b); */ int ans = 1e18+18; for(int i = 0; i<n; ++i){ ans = min(ans, max(a[i], b[i])); } cout<<ans; cout<<'\n'; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 47 ms | 5112 KB | Output is correct |
12 | Correct | 44 ms | 5112 KB | Output is correct |
13 | Correct | 56 ms | 5144 KB | Output is correct |
14 | Correct | 45 ms | 7912 KB | Output is correct |
15 | Correct | 1 ms | 348 KB | Output is correct |
16 | Correct | 24 ms | 6124 KB | Output is correct |
17 | Correct | 51 ms | 10520 KB | Output is correct |
18 | Correct | 61 ms | 9960 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 24 ms | 6124 KB | Output is correct |
3 | Correct | 51 ms | 10520 KB | Output is correct |
4 | Correct | 61 ms | 9960 KB | Output is correct |
5 | Incorrect | 0 ms | 344 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 47 ms | 5112 KB | Output is correct |
12 | Correct | 44 ms | 5112 KB | Output is correct |
13 | Correct | 56 ms | 5144 KB | Output is correct |
14 | Correct | 45 ms | 7912 KB | Output is correct |
15 | Incorrect | 0 ms | 344 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 344 KB | Output is correct |
9 | Correct | 1 ms | 344 KB | Output is correct |
10 | Correct | 2 ms | 348 KB | Output is correct |
11 | Correct | 47 ms | 5112 KB | Output is correct |
12 | Correct | 44 ms | 5112 KB | Output is correct |
13 | Correct | 56 ms | 5144 KB | Output is correct |
14 | Correct | 45 ms | 7912 KB | Output is correct |
15 | Incorrect | 0 ms | 344 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |