# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
528005 | 2022-02-19T01:57:30 Z | amukkalir | Self Study (JOI22_ho_t2) | C++17 | 1000 ms | 288 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define prn printf #define scn scanf ll n, m; const int nax = 3e5; ll a[nax+5], b[nax+5]; ll updiv(ll a, ll b) { ll ret = a/b; if(b*ret!=a) ret++; return ret; } bool ok (ll x) { vector<ll> comp(n,0); ll rem = n*m; // for(int i=0; i<n; i++) { // for(int j=0; j<m; j++) { // if(comp[i] < x) { // comp[i] += b[i]; // rem--; // } // } // } for(int i=0;i <n; i++) while(comp[i] < x) { comp[i]+=b[i]; rem--; } return rem >= 0; } signed main () { scn("%lld %lld", &n, &m); for(int i=0; i<n; i++) scn("%lld", &a[i]); for(int i=0; i<n; i++) scn("%lld", &b[i]); ll ans = 0; ll lo = 0, hi = 1e18; while(lo <= hi) { ll mid = (lo+hi)>>1; if(ok(mid)) { ans = mid; lo = mid+1; } else hi = mid-1; } prn("%lld", ans); } /* binser cek (x) coba self study semua coba kalo nambahin dtg bsb erkurang ga harinya jumlahin harinya hrs less than or equal n*m */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 521 ms | 288 KB | Output is correct |
2 | Execution timed out | 1087 ms | 204 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 521 ms | 288 KB | Output is correct |
2 | Execution timed out | 1087 ms | 204 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 521 ms | 288 KB | Output is correct |
2 | Execution timed out | 1087 ms | 204 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |