답안 #907580

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
907580 2024-01-15T21:43:26 Z AlphaMale06 Self Study (JOI22_ho_t2) C++14
35 / 100
1000 ms 12004 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define int long long


void solve(){
	int n, m;
	cin >> n >> m;
	int a[n], b[n];
	for(int i=0; i< n; i++)cin >> a[i];
	for(int i=0; i< n; i++)cin >> b[i];	
	int l=0; int r=1e18+1;
	int ans=0;
	if(m==1){
		ans=1e18;
		for(int i=0; i< n; i++){
			ans=min(ans, max(a[i], b[i]));
		}
		cout << ans << '\n';
		return;
	}
	set<pair<int, int>> st;
	for(int i=0; i< n; i++){
		st.insert({0, i});
	}
	for(int i=0; i<n*m; i++){
		pair<int, int> k=*st.begin();
		st.erase(k);
		st.insert({k.F+a[k.S], k.S});
	}
	cout << (*st.begin()).F << '\n';
}


signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:21:6: warning: unused variable 'l' [-Wunused-variable]
   21 |  int l=0; int r=1e18+1;
      |      ^
Main.cpp:21:15: warning: unused variable 'r' [-Wunused-variable]
   21 |  int l=0; int r=1e18+1;
      |               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 53 ms 4956 KB Output is correct
12 Correct 52 ms 5120 KB Output is correct
13 Correct 36 ms 4952 KB Output is correct
14 Correct 39 ms 4952 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 26 ms 4952 KB Output is correct
17 Correct 57 ms 5120 KB Output is correct
18 Correct 47 ms 4956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 26 ms 4952 KB Output is correct
3 Correct 57 ms 5120 KB Output is correct
4 Correct 47 ms 4956 KB Output is correct
5 Correct 1 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 428 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 138 ms 12004 KB Output is correct
14 Correct 107 ms 8256 KB Output is correct
15 Correct 69 ms 6300 KB Output is correct
16 Correct 88 ms 5132 KB Output is correct
17 Correct 28 ms 348 KB Output is correct
18 Correct 20 ms 348 KB Output is correct
19 Correct 17 ms 348 KB Output is correct
20 Correct 8 ms 452 KB Output is correct
21 Correct 11 ms 348 KB Output is correct
22 Correct 38 ms 604 KB Output is correct
23 Correct 38 ms 816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 53 ms 4956 KB Output is correct
12 Correct 52 ms 5120 KB Output is correct
13 Correct 36 ms 4952 KB Output is correct
14 Correct 39 ms 4952 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 428 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 138 ms 12004 KB Output is correct
24 Correct 107 ms 8256 KB Output is correct
25 Correct 69 ms 6300 KB Output is correct
26 Correct 88 ms 5132 KB Output is correct
27 Correct 28 ms 348 KB Output is correct
28 Correct 20 ms 348 KB Output is correct
29 Correct 17 ms 348 KB Output is correct
30 Correct 8 ms 452 KB Output is correct
31 Correct 11 ms 348 KB Output is correct
32 Correct 38 ms 604 KB Output is correct
33 Correct 38 ms 816 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 26 ms 4952 KB Output is correct
36 Correct 57 ms 5120 KB Output is correct
37 Correct 47 ms 4956 KB Output is correct
38 Incorrect 1 ms 348 KB Output isn't correct
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 428 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 138 ms 12004 KB Output is correct
10 Correct 107 ms 8256 KB Output is correct
11 Correct 69 ms 6300 KB Output is correct
12 Correct 88 ms 5132 KB Output is correct
13 Correct 28 ms 348 KB Output is correct
14 Correct 20 ms 348 KB Output is correct
15 Correct 17 ms 348 KB Output is correct
16 Correct 8 ms 452 KB Output is correct
17 Correct 11 ms 348 KB Output is correct
18 Correct 38 ms 604 KB Output is correct
19 Correct 38 ms 816 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 26 ms 4952 KB Output is correct
22 Correct 57 ms 5120 KB Output is correct
23 Correct 47 ms 4956 KB Output is correct
24 Execution timed out 1063 ms 3932 KB Time limit exceeded
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 600 KB Output is correct
11 Correct 53 ms 4956 KB Output is correct
12 Correct 52 ms 5120 KB Output is correct
13 Correct 36 ms 4952 KB Output is correct
14 Correct 39 ms 4952 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 428 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 138 ms 12004 KB Output is correct
24 Correct 107 ms 8256 KB Output is correct
25 Correct 69 ms 6300 KB Output is correct
26 Correct 88 ms 5132 KB Output is correct
27 Correct 28 ms 348 KB Output is correct
28 Correct 20 ms 348 KB Output is correct
29 Correct 17 ms 348 KB Output is correct
30 Correct 8 ms 452 KB Output is correct
31 Correct 11 ms 348 KB Output is correct
32 Correct 38 ms 604 KB Output is correct
33 Correct 38 ms 816 KB Output is correct
34 Incorrect 1 ms 348 KB Output isn't correct
35 Halted 0 ms 0 KB -