답안 #528018

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
528018 2022-02-19T02:22:39 Z amukkalir Self Study (JOI22_ho_t2) C++17
0 / 100
197 ms 5440 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]; 

bool ok (ll x) {
    ll jum = 0; 
    for(int i=0; i<n; i++) {
        //if(max(a[i], b[i]) < x) return false; 
        jum += ceil((double)x/max(a[i],b[i])); 
    }
    return jum == n; 
}

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

Main.cpp: In function 'int main()':
Main.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scn("%lld %lld", &n, &m);
      |        ^
Main.cpp:23:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |     for(int i=0; i<n; i++) scn("%lld", &a[i]);
      |                               ^
Main.cpp:24:31: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     for(int i=0; i<n; i++) scn("%lld", &b[i]);
      |                               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 460 KB Output is correct
11 Correct 197 ms 5316 KB Output is correct
12 Correct 183 ms 5436 KB Output is correct
13 Correct 182 ms 5440 KB Output is correct
14 Correct 178 ms 5436 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Incorrect 160 ms 5248 KB Output isn't correct
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 160 ms 5248 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 460 KB Output is correct
11 Correct 197 ms 5316 KB Output is correct
12 Correct 183 ms 5436 KB Output is correct
13 Correct 182 ms 5440 KB Output is correct
14 Correct 178 ms 5436 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Incorrect 160 ms 5248 KB Output isn't correct
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 160 ms 5248 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 3 ms 460 KB Output is correct
11 Correct 197 ms 5316 KB Output is correct
12 Correct 183 ms 5436 KB Output is correct
13 Correct 182 ms 5440 KB Output is correct
14 Correct 178 ms 5436 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Incorrect 160 ms 5248 KB Output isn't correct
17 Halted 0 ms 0 KB -