# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
674587 | 2022-12-25T07:52:52 Z | guagua0407 | Self Study (JOI22_ho_t2) | C++17 | 390 ms | 11452 KB |
/* 希望全國賽不要墊底 全國賽策略: 0:00-0:15:讀題 0:15-3:00:寫掉有把握的 3:00-5:00:撈分+寫掉快好的 記得上廁所 記得吃東西 */ #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<ll,ll> #define f first #define s second #define all(x) x.begin(),x.end() #define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } const ll mxn=3e5+5; ll n,m; ll a[mxn],b[mxn]; bool check(ll k){ __int128 need=0,used=0; for(ll i=0;i<n;i++){ ll tmp=min(m,(k+a[i]-1)/a[i]); ll kk=k-(tmp*a[i]); if(kk>0){ need+=(kk+b[i]-1)/b[i]; } else{ used+=m-tmp; } } return used>=need; } int main() {_ //setIO("wayne"); cin>>n>>m; for(ll i=0;i<n;i++){ cin>>a[i]; } for(ll i=0;i<n;i++){ cin>>b[i]; a[i]=max(a[i],b[i]); } ll l = 0, r = 4e18; while (l!=r) { ll mid = (l+r)/2; if (check(mid)) { l = mid+1; }else{ r = mid; } } cout<<l-1<<'\n'; return 0; } //maybe its multiset not set
Compilation message
# | 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 | 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 | 1 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 235 ms | 4924 KB | Output is correct |
12 | Correct | 233 ms | 5072 KB | Output is correct |
13 | Correct | 238 ms | 4912 KB | Output is correct |
14 | Correct | 293 ms | 4940 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 367 ms | 6136 KB | Output is correct |
17 | Correct | 265 ms | 11428 KB | Output is correct |
18 | Correct | 238 ms | 10796 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 367 ms | 6136 KB | Output is correct |
3 | Correct | 265 ms | 11428 KB | Output is correct |
4 | Correct | 238 ms | 10796 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 120 ms | 2680 KB | Output is correct |
14 | Correct | 80 ms | 1868 KB | Output is correct |
15 | Correct | 60 ms | 1488 KB | Output is correct |
16 | Correct | 49 ms | 1356 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 284 KB | Output is correct |
20 | Correct | 1 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 6 ms | 340 KB | Output is correct |
23 | Correct | 5 ms | 460 KB | Output is correct |
# | 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 | 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 | 1 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 235 ms | 4924 KB | Output is correct |
12 | Correct | 233 ms | 5072 KB | Output is correct |
13 | Correct | 238 ms | 4912 KB | Output is correct |
14 | Correct | 293 ms | 4940 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 120 ms | 2680 KB | Output is correct |
24 | Correct | 80 ms | 1868 KB | Output is correct |
25 | Correct | 60 ms | 1488 KB | Output is correct |
26 | Correct | 49 ms | 1356 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 0 ms | 284 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 0 ms | 212 KB | Output is correct |
32 | Correct | 6 ms | 340 KB | Output is correct |
33 | Correct | 5 ms | 460 KB | Output is correct |
34 | Correct | 0 ms | 212 KB | Output is correct |
35 | Correct | 367 ms | 6136 KB | Output is correct |
36 | Correct | 265 ms | 11428 KB | Output is correct |
37 | Correct | 238 ms | 10796 KB | Output is correct |
38 | Correct | 0 ms | 328 KB | Output is correct |
39 | Correct | 1 ms | 212 KB | Output is correct |
40 | Correct | 1 ms | 328 KB | Output is correct |
41 | Correct | 1 ms | 324 KB | Output is correct |
42 | Correct | 0 ms | 340 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
44 | Correct | 1 ms | 212 KB | Output is correct |
45 | Correct | 5 ms | 468 KB | Output is correct |
46 | Correct | 9 ms | 596 KB | Output is correct |
47 | Correct | 1 ms | 340 KB | Output is correct |
48 | Correct | 44 ms | 2132 KB | Output is correct |
49 | Correct | 0 ms | 212 KB | Output is correct |
50 | Correct | 1 ms | 212 KB | Output is correct |
51 | Correct | 5 ms | 472 KB | Output is correct |
52 | Correct | 1 ms | 212 KB | Output is correct |
53 | Correct | 0 ms | 212 KB | Output is correct |
54 | Correct | 0 ms | 340 KB | Output is correct |
55 | Correct | 120 ms | 5576 KB | Output is correct |
56 | Correct | 82 ms | 3152 KB | Output is correct |
57 | Correct | 104 ms | 3148 KB | Output is correct |
# | 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 | 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 | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 120 ms | 2680 KB | Output is correct |
10 | Correct | 80 ms | 1868 KB | Output is correct |
11 | Correct | 60 ms | 1488 KB | Output is correct |
12 | Correct | 49 ms | 1356 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 0 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 284 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 6 ms | 340 KB | Output is correct |
19 | Correct | 5 ms | 460 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 367 ms | 6136 KB | Output is correct |
22 | Correct | 265 ms | 11428 KB | Output is correct |
23 | Correct | 238 ms | 10796 KB | Output is correct |
24 | Correct | 43 ms | 1944 KB | Output is correct |
25 | Correct | 115 ms | 5012 KB | Output is correct |
26 | Correct | 28 ms | 1356 KB | Output is correct |
27 | Correct | 240 ms | 10796 KB | Output is correct |
28 | Correct | 250 ms | 10804 KB | Output is correct |
29 | Correct | 244 ms | 10836 KB | Output is correct |
30 | Correct | 249 ms | 10800 KB | Output is correct |
31 | Correct | 242 ms | 10852 KB | Output is correct |
32 | Correct | 355 ms | 6092 KB | Output is correct |
33 | Correct | 350 ms | 11452 KB | Output is correct |
34 | Correct | 376 ms | 6168 KB | Output is correct |
# | 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 | 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 | 1 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 | 0 ms | 212 KB | Output is correct |
10 | Correct | 4 ms | 340 KB | Output is correct |
11 | Correct | 235 ms | 4924 KB | Output is correct |
12 | Correct | 233 ms | 5072 KB | Output is correct |
13 | Correct | 238 ms | 4912 KB | Output is correct |
14 | Correct | 293 ms | 4940 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 0 ms | 212 KB | Output is correct |
19 | Correct | 0 ms | 212 KB | Output is correct |
20 | Correct | 0 ms | 212 KB | Output is correct |
21 | Correct | 0 ms | 212 KB | Output is correct |
22 | Correct | 0 ms | 212 KB | Output is correct |
23 | Correct | 120 ms | 2680 KB | Output is correct |
24 | Correct | 80 ms | 1868 KB | Output is correct |
25 | Correct | 60 ms | 1488 KB | Output is correct |
26 | Correct | 49 ms | 1356 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 0 ms | 212 KB | Output is correct |
29 | Correct | 0 ms | 284 KB | Output is correct |
30 | Correct | 1 ms | 212 KB | Output is correct |
31 | Correct | 0 ms | 212 KB | Output is correct |
32 | Correct | 6 ms | 340 KB | Output is correct |
33 | Correct | 5 ms | 460 KB | Output is correct |
34 | Correct | 0 ms | 328 KB | Output is correct |
35 | Correct | 1 ms | 212 KB | Output is correct |
36 | Correct | 1 ms | 328 KB | Output is correct |
37 | Correct | 1 ms | 324 KB | Output is correct |
38 | Correct | 0 ms | 340 KB | Output is correct |
39 | Correct | 1 ms | 340 KB | Output is correct |
40 | Correct | 1 ms | 212 KB | Output is correct |
41 | Correct | 5 ms | 468 KB | Output is correct |
42 | Correct | 9 ms | 596 KB | Output is correct |
43 | Correct | 1 ms | 340 KB | Output is correct |
44 | Correct | 44 ms | 2132 KB | Output is correct |
45 | Correct | 0 ms | 212 KB | Output is correct |
46 | Correct | 1 ms | 212 KB | Output is correct |
47 | Correct | 5 ms | 472 KB | Output is correct |
48 | Correct | 1 ms | 212 KB | Output is correct |
49 | Correct | 0 ms | 212 KB | Output is correct |
50 | Correct | 0 ms | 340 KB | Output is correct |
51 | Correct | 120 ms | 5576 KB | Output is correct |
52 | Correct | 82 ms | 3152 KB | Output is correct |
53 | Correct | 104 ms | 3148 KB | Output is correct |
54 | Correct | 43 ms | 1944 KB | Output is correct |
55 | Correct | 115 ms | 5012 KB | Output is correct |
56 | Correct | 28 ms | 1356 KB | Output is correct |
57 | Correct | 240 ms | 10796 KB | Output is correct |
58 | Correct | 250 ms | 10804 KB | Output is correct |
59 | Correct | 244 ms | 10836 KB | Output is correct |
60 | Correct | 249 ms | 10800 KB | Output is correct |
61 | Correct | 242 ms | 10852 KB | Output is correct |
62 | Correct | 355 ms | 6092 KB | Output is correct |
63 | Correct | 350 ms | 11452 KB | Output is correct |
64 | Correct | 376 ms | 6168 KB | Output is correct |
65 | Correct | 0 ms | 212 KB | Output is correct |
66 | Correct | 367 ms | 6136 KB | Output is correct |
67 | Correct | 265 ms | 11428 KB | Output is correct |
68 | Correct | 238 ms | 10796 KB | Output is correct |
69 | Correct | 29 ms | 1364 KB | Output is correct |
70 | Correct | 8 ms | 588 KB | Output is correct |
71 | Correct | 1 ms | 212 KB | Output is correct |
72 | Correct | 39 ms | 1912 KB | Output is correct |
73 | Correct | 9 ms | 608 KB | Output is correct |
74 | Correct | 1 ms | 356 KB | Output is correct |
75 | Correct | 243 ms | 10716 KB | Output is correct |
76 | Correct | 246 ms | 10700 KB | Output is correct |
77 | Correct | 247 ms | 10776 KB | Output is correct |
78 | Correct | 258 ms | 10796 KB | Output is correct |
79 | Correct | 264 ms | 10768 KB | Output is correct |
80 | Correct | 255 ms | 10700 KB | Output is correct |
81 | Correct | 328 ms | 8808 KB | Output is correct |
82 | Correct | 390 ms | 8848 KB | Output is correct |