//君の手を握ってしまったら
//孤独を知らないこの街には
//もう二度と帰ってくることはできないのでしょう
//君が手を差し伸べた 光で影が生まれる
//歌って聞かせて この話の続き
//連れて行って見たことない星まで
//さユリ - 花の塔
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pii pair<int,int>
#define pb push_back
#define ff first
#define ss second
//#define N 100005
void solve(){
int N, M; cin >> N >> M;
vector<int> A(N), B(N);
for(auto &x:A) cin >> x;
for(auto &x:B) cin >> x;
if(N * M > 300000) return;
int k = N * M;
priority_queue<pii, vector<pii>, greater<pii>> pq;
for(int i = 0; i < N; ++i) pq.push(pii(0, i));
while(k--){
pii p = pq.top(); pq.pop();
p.ff += A[p.ss];
pq.push(p);
}
cout << pq.top().ff;
}
signed main(){
starburst
int t = 1; //cin >> t;
while(t--) solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
316 KB |
Output is correct |
9 |
Correct |
67 ms |
7020 KB |
Output is correct |
10 |
Correct |
51 ms |
5964 KB |
Output is correct |
11 |
Correct |
40 ms |
5076 KB |
Output is correct |
12 |
Correct |
53 ms |
3556 KB |
Output is correct |
13 |
Correct |
16 ms |
324 KB |
Output is correct |
14 |
Correct |
10 ms |
316 KB |
Output is correct |
15 |
Correct |
6 ms |
212 KB |
Output is correct |
16 |
Correct |
7 ms |
320 KB |
Output is correct |
17 |
Correct |
7 ms |
212 KB |
Output is correct |
18 |
Correct |
23 ms |
560 KB |
Output is correct |
19 |
Correct |
22 ms |
616 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
71 ms |
14464 KB |
Output is correct |
22 |
Correct |
110 ms |
19704 KB |
Output is correct |
23 |
Correct |
106 ms |
19072 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
316 KB |
Output is correct |
9 |
Correct |
67 ms |
7020 KB |
Output is correct |
10 |
Correct |
51 ms |
5964 KB |
Output is correct |
11 |
Correct |
40 ms |
5076 KB |
Output is correct |
12 |
Correct |
53 ms |
3556 KB |
Output is correct |
13 |
Correct |
16 ms |
324 KB |
Output is correct |
14 |
Correct |
10 ms |
316 KB |
Output is correct |
15 |
Correct |
6 ms |
212 KB |
Output is correct |
16 |
Correct |
7 ms |
320 KB |
Output is correct |
17 |
Correct |
7 ms |
212 KB |
Output is correct |
18 |
Correct |
23 ms |
560 KB |
Output is correct |
19 |
Correct |
22 ms |
616 KB |
Output is correct |
20 |
Correct |
0 ms |
212 KB |
Output is correct |
21 |
Correct |
71 ms |
14464 KB |
Output is correct |
22 |
Correct |
110 ms |
19704 KB |
Output is correct |
23 |
Correct |
106 ms |
19072 KB |
Output is correct |
24 |
Incorrect |
9 ms |
1876 KB |
Output isn't correct |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |