# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
588081 |
2022-07-02T17:12:32 Z |
Mounir |
Self Study (JOI22_ho_t2) |
C++14 |
|
321 ms |
5148 KB |
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define sz(x) (int)x.size()
#define pb push_back
#define pii pair<int, int>
#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
#define print(x) cout << #x << " est " << x << endl;
#define x first
#define y second
#define int long long
using namespace std;
const int N = 1e6;
int nCours, nWeeks;
int a[N], b[N];
inline bool isOk(int bInf){
int aAllouer = 0;
for (int iCours = 0; iCours < nCours; ++iCours){
int besoin = ceil(bInf/(long double)(a[iCours]));
if (besoin <= nWeeks)
aAllouer += nWeeks - besoin;
else {
int reste = bInf - nWeeks * a[iCours];
reste = ceil((long double)(reste)/b[iCours]);
aAllouer -= reste;
}
}
// cout << aAllouer
return aAllouer >= 0;
}
signed main(){
cin >> nCours >> nWeeks;
for (int i = 0; i < nCours; ++i)
cin >> a[i];
for (int i = 0; i < nCours; ++i){
cin >> b[i];
chmax(a[i], b[i]);
}
int gauche = 0, droite = 1e18;
while (droite > gauche){
int mid = (gauche + droite)/2 + 1;
if (isOk(mid))
gauche = mid;
else
droite = mid - 1;
}
cout << gauche << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
6 ms |
380 KB |
Output is correct |
11 |
Correct |
310 ms |
4952 KB |
Output is correct |
12 |
Correct |
321 ms |
5148 KB |
Output is correct |
13 |
Correct |
262 ms |
4988 KB |
Output is correct |
14 |
Incorrect |
280 ms |
5068 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
304 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
164 ms |
2640 KB |
Output is correct |
10 |
Correct |
110 ms |
2520 KB |
Output is correct |
11 |
Correct |
81 ms |
2156 KB |
Output is correct |
12 |
Correct |
66 ms |
1860 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
304 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
6 ms |
380 KB |
Output is correct |
11 |
Correct |
310 ms |
4952 KB |
Output is correct |
12 |
Correct |
321 ms |
5148 KB |
Output is correct |
13 |
Correct |
262 ms |
4988 KB |
Output is correct |
14 |
Incorrect |
280 ms |
5068 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
304 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
164 ms |
2640 KB |
Output is correct |
10 |
Correct |
110 ms |
2520 KB |
Output is correct |
11 |
Correct |
81 ms |
2156 KB |
Output is correct |
12 |
Correct |
66 ms |
1860 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
304 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
6 ms |
380 KB |
Output is correct |
11 |
Correct |
310 ms |
4952 KB |
Output is correct |
12 |
Correct |
321 ms |
5148 KB |
Output is correct |
13 |
Correct |
262 ms |
4988 KB |
Output is correct |
14 |
Incorrect |
280 ms |
5068 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |