제출 #528136

#제출 시각아이디문제언어결과실행 시간메모리
528136dooweySelf Study (JOI22_ho_t2)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair #define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); const int N = (int)3e5 + 10; ll A[N]; ll B[N]; ll ceil(ll x, ll y){ return (x + y - 1) / y; } int main(){ fastIO; //freopen("in.txt","r",stdin); ll m; int n; cin >> n >> m; for(int i = 1; i <= n; i ++ ){ cin >> A[i]; } for(int i = 1; i <= n; i ++ ){ cin >> B[i]; } for(int i = 1; i <= n; i ++ ){ A[i] = max(A[i], B[i]); } ll li = 1; ll ri = (ll)1e17; ll mid; ll have = 0; ll need = 0; ll take; ll rem; while(li + 1 < ri){ mid = (li + ri) / 2ll; have = 0; for(int i = 1; i <= n; i ++ ){ if(mid <= A[i] * 1ll * m){ have += ceil(mid, A[i]); } else{ have += ceil(mid - A[i] * 1ll * m, B[i]); } } if(have >= n * 1ll * m){ li = mid; } else{ ri = mid; } } cout << li << "\n"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:40:8: warning: unused variable 'need' [-Wunused-variable]
   40 |     ll need = 0;
      |        ^~~~
Main.cpp:41:8: warning: unused variable 'take' [-Wunused-variable]
   41 |     ll take;
      |        ^~~~
Main.cpp:42:8: warning: unused variable 'rem' [-Wunused-variable]
   42 |     ll rem;
      |        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...