Submission #907566

# Submission time Handle Problem Language Result Execution time Memory
907566 2024-01-15T21:17:11 Z vjudge1 Self Study (JOI22_ho_t2) C++17
35 / 100
60 ms 7636 KB
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vi;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	ll n,m;cin>>n>>m;
	vi a(n);rep(i,0,n)cin>>a[i];
	vi b(n);rep(i,0,n)cin>>b[i];
	bool eq = true;
	rep(i,0,n)if(a[i]!=b[i]) eq=false;
	ll worst = 1e18;
	if(m==1){
		rep(i,0,n) worst=min(worst,m*max(a[i],b[i]));
	}else if(n*m <= 300000){
		priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> pq;
		rep(i,0,n) pq.push({0,i});
		rep(_,0,n*m){
			auto p = pq.top(); pq.pop();
			pq.push({p.F + a[p.S], p.S});
		}
		worst = pq.top().F;
	}
	cout<<worst<<endl;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:20:7: warning: variable 'eq' set but not used [-Wunused-but-set-variable]
   20 |  bool eq = true;
      |       ^~
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 504 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 60 ms 5144 KB Output is correct
12 Correct 46 ms 4956 KB Output is correct
13 Correct 37 ms 4956 KB Output is correct
14 Correct 36 ms 4952 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 24 ms 4956 KB Output is correct
17 Correct 52 ms 5136 KB Output is correct
18 Correct 47 ms 5136 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 24 ms 4956 KB Output is correct
3 Correct 52 ms 5136 KB Output is correct
4 Correct 47 ms 5136 KB Output is correct
5 Correct 1 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 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 600 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 54 ms 7636 KB Output is correct
14 Correct 44 ms 4204 KB Output is correct
15 Correct 32 ms 3816 KB Output is correct
16 Correct 43 ms 2524 KB Output is correct
17 Correct 14 ms 348 KB Output is correct
18 Correct 8 ms 456 KB Output is correct
19 Correct 6 ms 348 KB Output is correct
20 Correct 4 ms 348 KB Output is correct
21 Correct 4 ms 348 KB Output is correct
22 Correct 20 ms 668 KB Output is correct
23 Correct 24 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 504 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 60 ms 5144 KB Output is correct
12 Correct 46 ms 4956 KB Output is correct
13 Correct 37 ms 4956 KB Output is correct
14 Correct 36 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 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 54 ms 7636 KB Output is correct
24 Correct 44 ms 4204 KB Output is correct
25 Correct 32 ms 3816 KB Output is correct
26 Correct 43 ms 2524 KB Output is correct
27 Correct 14 ms 348 KB Output is correct
28 Correct 8 ms 456 KB Output is correct
29 Correct 6 ms 348 KB Output is correct
30 Correct 4 ms 348 KB Output is correct
31 Correct 4 ms 348 KB Output is correct
32 Correct 20 ms 668 KB Output is correct
33 Correct 24 ms 672 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 24 ms 4956 KB Output is correct
36 Correct 52 ms 5136 KB Output is correct
37 Correct 47 ms 5136 KB Output is correct
38 Incorrect 1 ms 516 KB Output isn't correct
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 54 ms 7636 KB Output is correct
10 Correct 44 ms 4204 KB Output is correct
11 Correct 32 ms 3816 KB Output is correct
12 Correct 43 ms 2524 KB Output is correct
13 Correct 14 ms 348 KB Output is correct
14 Correct 8 ms 456 KB Output is correct
15 Correct 6 ms 348 KB Output is correct
16 Correct 4 ms 348 KB Output is correct
17 Correct 4 ms 348 KB Output is correct
18 Correct 20 ms 668 KB Output is correct
19 Correct 24 ms 672 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 24 ms 4956 KB Output is correct
22 Correct 52 ms 5136 KB Output is correct
23 Correct 47 ms 5136 KB Output is correct
24 Incorrect 8 ms 1116 KB Output isn't correct
25 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 504 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 60 ms 5144 KB Output is correct
12 Correct 46 ms 4956 KB Output is correct
13 Correct 37 ms 4956 KB Output is correct
14 Correct 36 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 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 54 ms 7636 KB Output is correct
24 Correct 44 ms 4204 KB Output is correct
25 Correct 32 ms 3816 KB Output is correct
26 Correct 43 ms 2524 KB Output is correct
27 Correct 14 ms 348 KB Output is correct
28 Correct 8 ms 456 KB Output is correct
29 Correct 6 ms 348 KB Output is correct
30 Correct 4 ms 348 KB Output is correct
31 Correct 4 ms 348 KB Output is correct
32 Correct 20 ms 668 KB Output is correct
33 Correct 24 ms 672 KB Output is correct
34 Incorrect 1 ms 516 KB Output isn't correct
35 Halted 0 ms 0 KB -