#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=3e5+5;
ll n, m, a[nx], b[nx];
priority_queue<pair<ll, ll>, vector<pair<ll, ll>>, greater<pair<ll, ll>>> pq;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>m;
for (int i=1; i<=n; i++) cin>>a[i];
for (int i=1; i<=n; i++) cin>>b[i], pq.push({0, i});
for (int i=1; i<=n*m; i++)
{
auto [x, idx]=pq.top();
pq.pop();
pq.push({x+a[idx], idx});
}
cout<<pq.top().first;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2476 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2488 KB |
Output is correct |
7 |
Correct |
1 ms |
2512 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
53 ms |
12732 KB |
Output is correct |
10 |
Correct |
43 ms |
8652 KB |
Output is correct |
11 |
Correct |
33 ms |
8152 KB |
Output is correct |
12 |
Correct |
41 ms |
6872 KB |
Output is correct |
13 |
Correct |
14 ms |
2396 KB |
Output is correct |
14 |
Correct |
8 ms |
2516 KB |
Output is correct |
15 |
Correct |
6 ms |
2396 KB |
Output is correct |
16 |
Correct |
4 ms |
2396 KB |
Output is correct |
17 |
Correct |
4 ms |
2396 KB |
Output is correct |
18 |
Correct |
18 ms |
2652 KB |
Output is correct |
19 |
Correct |
18 ms |
2652 KB |
Output is correct |
20 |
Correct |
0 ms |
2500 KB |
Output is correct |
21 |
Correct |
53 ms |
14032 KB |
Output is correct |
22 |
Correct |
77 ms |
15304 KB |
Output is correct |
23 |
Correct |
73 ms |
13808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2392 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2476 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2488 KB |
Output is correct |
7 |
Correct |
1 ms |
2512 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
53 ms |
12732 KB |
Output is correct |
10 |
Correct |
43 ms |
8652 KB |
Output is correct |
11 |
Correct |
33 ms |
8152 KB |
Output is correct |
12 |
Correct |
41 ms |
6872 KB |
Output is correct |
13 |
Correct |
14 ms |
2396 KB |
Output is correct |
14 |
Correct |
8 ms |
2516 KB |
Output is correct |
15 |
Correct |
6 ms |
2396 KB |
Output is correct |
16 |
Correct |
4 ms |
2396 KB |
Output is correct |
17 |
Correct |
4 ms |
2396 KB |
Output is correct |
18 |
Correct |
18 ms |
2652 KB |
Output is correct |
19 |
Correct |
18 ms |
2652 KB |
Output is correct |
20 |
Correct |
0 ms |
2500 KB |
Output is correct |
21 |
Correct |
53 ms |
14032 KB |
Output is correct |
22 |
Correct |
77 ms |
15304 KB |
Output is correct |
23 |
Correct |
73 ms |
13808 KB |
Output is correct |
24 |
Execution timed out |
1089 ms |
6616 KB |
Time limit exceeded |
25 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |