#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int n,m; cin>>n>>m;
vector<ll> a(n), b(n);
for (auto &i: a) cin>>i;
for (auto &i: b) cin>>i;
priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> q;
for (int i=0; i<n; i++) q.push({0ll,i});
for (int i=0; i<n*m; i++) {
auto t=q.top(); q.pop();
q.push({t.first+b[t.second],t.second});
}
cout<<q.top().first;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
143 ms |
10804 KB |
Output is correct |
10 |
Correct |
89 ms |
5940 KB |
Output is correct |
11 |
Correct |
66 ms |
5060 KB |
Output is correct |
12 |
Correct |
66 ms |
3528 KB |
Output is correct |
13 |
Correct |
16 ms |
480 KB |
Output is correct |
14 |
Correct |
8 ms |
344 KB |
Output is correct |
15 |
Correct |
7 ms |
428 KB |
Output is correct |
16 |
Correct |
4 ms |
440 KB |
Output is correct |
17 |
Correct |
4 ms |
348 KB |
Output is correct |
18 |
Correct |
21 ms |
524 KB |
Output is correct |
19 |
Correct |
23 ms |
736 KB |
Output is correct |
20 |
Correct |
0 ms |
600 KB |
Output is correct |
21 |
Correct |
101 ms |
14528 KB |
Output is correct |
22 |
Correct |
209 ms |
13676 KB |
Output is correct |
23 |
Correct |
203 ms |
14184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 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 |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
143 ms |
10804 KB |
Output is correct |
10 |
Correct |
89 ms |
5940 KB |
Output is correct |
11 |
Correct |
66 ms |
5060 KB |
Output is correct |
12 |
Correct |
66 ms |
3528 KB |
Output is correct |
13 |
Correct |
16 ms |
480 KB |
Output is correct |
14 |
Correct |
8 ms |
344 KB |
Output is correct |
15 |
Correct |
7 ms |
428 KB |
Output is correct |
16 |
Correct |
4 ms |
440 KB |
Output is correct |
17 |
Correct |
4 ms |
348 KB |
Output is correct |
18 |
Correct |
21 ms |
524 KB |
Output is correct |
19 |
Correct |
23 ms |
736 KB |
Output is correct |
20 |
Correct |
0 ms |
600 KB |
Output is correct |
21 |
Correct |
101 ms |
14528 KB |
Output is correct |
22 |
Correct |
209 ms |
13676 KB |
Output is correct |
23 |
Correct |
203 ms |
14184 KB |
Output is correct |
24 |
Execution timed out |
1082 ms |
3176 KB |
Time limit exceeded |
25 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |