Submission #536769

# Submission time Handle Problem Language Result Execution time Memory
536769 2022-03-14T02:38:28 Z xp875 Self Study (JOI22_ho_t2) C++17
35 / 100
1000 ms 12040 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  	ios_base::sync_with_stdio(0); cin.tie(0);
	ll n, m;
	cin >> n >> m;
	ll a[n], b[n];
	for(int i=0; i<n; i++) cin >> a[i];
	for(int i=0; i<n; i++) cin >> b[i];
	
	if(m==1) {
		ll ans = (ll)1<<60;
		for(int i=0; i<n; i++) {
			ans = min(ans, max(a[i], b[i]));
		}
		cout << ans;
	}
	else { //a[i] == b[i]
		set<pair<ll, ll> > s;
		for(int i=0; i<n; i++) {
			s.insert(make_pair(0, i));
		}
		for(int i=0; i<m*n; i++) {
			pair<ll, ll> p = *s.begin();
			s.erase(s.find(p));
			p.first += a[p.second];
			s.insert(p);
		}
		//for(auto p : s) cout << p.first << ' ';
		cout << s.begin()->first;
			
		
		
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 56 ms 4948 KB Output is correct
12 Correct 57 ms 4992 KB Output is correct
13 Correct 52 ms 4988 KB Output is correct
14 Correct 53 ms 4948 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 28 ms 4948 KB Output is correct
17 Correct 76 ms 4992 KB Output is correct
18 Correct 57 ms 4996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 28 ms 4948 KB Output is correct
3 Correct 76 ms 4992 KB Output is correct
4 Correct 57 ms 4996 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 1 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 189 ms 12040 KB Output is correct
14 Correct 145 ms 8124 KB Output is correct
15 Correct 95 ms 6208 KB Output is correct
16 Correct 105 ms 4956 KB Output is correct
17 Correct 32 ms 340 KB Output is correct
18 Correct 26 ms 312 KB Output is correct
19 Correct 19 ms 312 KB Output is correct
20 Correct 11 ms 320 KB Output is correct
21 Correct 11 ms 320 KB Output is correct
22 Correct 52 ms 684 KB Output is correct
23 Correct 48 ms 724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 56 ms 4948 KB Output is correct
12 Correct 57 ms 4992 KB Output is correct
13 Correct 52 ms 4988 KB Output is correct
14 Correct 53 ms 4948 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 1 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 189 ms 12040 KB Output is correct
24 Correct 145 ms 8124 KB Output is correct
25 Correct 95 ms 6208 KB Output is correct
26 Correct 105 ms 4956 KB Output is correct
27 Correct 32 ms 340 KB Output is correct
28 Correct 26 ms 312 KB Output is correct
29 Correct 19 ms 312 KB Output is correct
30 Correct 11 ms 320 KB Output is correct
31 Correct 11 ms 320 KB Output is correct
32 Correct 52 ms 684 KB Output is correct
33 Correct 48 ms 724 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 28 ms 4948 KB Output is correct
36 Correct 76 ms 4992 KB Output is correct
37 Correct 57 ms 4996 KB Output is correct
38 Incorrect 1 ms 324 KB Output isn't correct
39 Halted 0 ms 0 KB -
# 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 1 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 189 ms 12040 KB Output is correct
10 Correct 145 ms 8124 KB Output is correct
11 Correct 95 ms 6208 KB Output is correct
12 Correct 105 ms 4956 KB Output is correct
13 Correct 32 ms 340 KB Output is correct
14 Correct 26 ms 312 KB Output is correct
15 Correct 19 ms 312 KB Output is correct
16 Correct 11 ms 320 KB Output is correct
17 Correct 11 ms 320 KB Output is correct
18 Correct 52 ms 684 KB Output is correct
19 Correct 48 ms 724 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 28 ms 4948 KB Output is correct
22 Correct 76 ms 4992 KB Output is correct
23 Correct 57 ms 4996 KB Output is correct
24 Execution timed out 1078 ms 4724 KB Time limit exceeded
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 56 ms 4948 KB Output is correct
12 Correct 57 ms 4992 KB Output is correct
13 Correct 52 ms 4988 KB Output is correct
14 Correct 53 ms 4948 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 1 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 189 ms 12040 KB Output is correct
24 Correct 145 ms 8124 KB Output is correct
25 Correct 95 ms 6208 KB Output is correct
26 Correct 105 ms 4956 KB Output is correct
27 Correct 32 ms 340 KB Output is correct
28 Correct 26 ms 312 KB Output is correct
29 Correct 19 ms 312 KB Output is correct
30 Correct 11 ms 320 KB Output is correct
31 Correct 11 ms 320 KB Output is correct
32 Correct 52 ms 684 KB Output is correct
33 Correct 48 ms 724 KB Output is correct
34 Incorrect 1 ms 324 KB Output isn't correct
35 Halted 0 ms 0 KB -