# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
937955 | 2024-03-04T17:10:31 Z | Litusiano | Self Study (JOI22_ho_t2) | C++17 | 435 ms | 7488 KB |
#include<bits/stdc++.h> using namespace std; #define int long long #define endl "\n" vector<pair<int,int>> v; int n,m; bool check(int mid){ vector<int> need(n,0); int left = 0; for(int i = 0; i<n; i++){ int z = max(v[i].first, v[i].second); int z1 = z + mid -1; int k = (z1)/z; z*=m; if(k > m) need[i] = mid-(z); else left+=m-k; } for(int i = 0; i<n; i++){ int z = need[i]; z += v[i].second; z--; left -= (z)/v[i].second; } return left>=0; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>m; v.resize(n); for(auto& x : v) cin>>x.first; for(auto& x : v) cin>>x.second; int low = 0; int high = 1e18+5; while(high > low+1){ int middle = (low+high)/2; if(check(middle)) low = middle; else high = middle; } cout<<low<<endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 444 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 247 ms | 7488 KB | Output is correct |
12 | Correct | 258 ms | 7440 KB | Output is correct |
13 | Correct | 235 ms | 7468 KB | Output is correct |
14 | Incorrect | 435 ms | 7444 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 131 ms | 3924 KB | Output is correct |
10 | Correct | 84 ms | 2648 KB | Output is correct |
11 | Correct | 62 ms | 2136 KB | Output is correct |
12 | Correct | 51 ms | 1884 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Incorrect | 8 ms | 348 KB | Output isn't correct |
19 | 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 | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 444 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 247 ms | 7488 KB | Output is correct |
12 | Correct | 258 ms | 7440 KB | Output is correct |
13 | Correct | 235 ms | 7468 KB | Output is correct |
14 | Incorrect | 435 ms | 7444 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 131 ms | 3924 KB | Output is correct |
10 | Correct | 84 ms | 2648 KB | Output is correct |
11 | Correct | 62 ms | 2136 KB | Output is correct |
12 | Correct | 51 ms | 1884 KB | Output is correct |
13 | Correct | 1 ms | 348 KB | Output is correct |
14 | Correct | 1 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Incorrect | 8 ms | 348 KB | Output isn't correct |
19 | 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 | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 444 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 4 ms | 348 KB | Output is correct |
11 | Correct | 247 ms | 7488 KB | Output is correct |
12 | Correct | 258 ms | 7440 KB | Output is correct |
13 | Correct | 235 ms | 7468 KB | Output is correct |
14 | Incorrect | 435 ms | 7444 KB | Output isn't correct |
15 | Halted | 0 ms | 0 KB | - |