제출 #634017

#제출 시각아이디문제언어결과실행 시간메모리
634017AstraytSelf Study (JOI22_ho_t2)C++14
0 / 100
409 ms5264 KiB
//君の手を握ってしまったら //孤独を知らないこの街には //もう二度と帰ってくることはできないのでしょう //君が手を差し伸べた 光で影が生まれる //歌って聞かせて この話の続き //連れて行って見たことない星まで //さユリ - 花の塔 #include <bits/stdc++.h> using namespace std; typedef long long ll; #define int ll #define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define pii pair<int,int> #define pb push_back #define ff first #define ss second //#define N 100005 void solve(){ int N, M; cin >> N >> M; vector<int> A(N), B(N); for(auto &x:A) cin >> x; for(auto &x:B) cin >> x; for(int i = 0; i < N; ++i) A[i] = max(A[i], B[i]); int l = 0, r = 1e15 + 5; while(r != l){ int s = 0, mid = 1 + (l + r) / 2; for(int i = 0, t; i < N; ++i){ t = mid; if(t > M * A[i]) t -= A[i] * M, s += M; else { s += t / A[i]; if(t % A[i]) s++; continue; } if(t > (N * (M - 1)) * B[i]) s += t / B[i]; if(t % B[i]) s++; } if(s <= N * M) l = mid; else r = mid - 1; } cout << l << '\n'; } signed main(){ starburst int t = 1; //cin >> t; while(t--) solve(); }
#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...