Submission #796205

# Submission time Handle Problem Language Result Execution time Memory
796205 2023-07-28T07:53:01 Z Dan4Life Two Dishes (JOI19_dishes) C++17
0 / 100
119 ms 15940 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mxN = (int)1e6+10;
const int LINF = (int)2e18;
int n, m;
int a[2][mxN], s[2][mxN], p[2][mxN], pr[2][mxN], pr2[2][mxN];

int32_t main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m; int ans = -LINF;
	for(int j : {0,1}){
		for(int i = 1; i <= n; i++){
			cin >> a[j][i] >> s[j][i] >> p[j][i];
			pr[j][i]=pr[j][i-1]+a[j][i];
			pr2[j][i]=pr2[j][i-1]+p[j][i];
		}
		swap(n,m);
	}
	for(int k : {0,1}){
		int tim = 0;
		for(int i = 1; i <= n; i++){
			tim+=pr[0][i]<=s[0][1];
			int l = 1, r = m;
			while(l<r){
				int mid = (l+r+1)/2;
				if(pr[1][mid]<=s[0][1])l=mid;
				else r=mid-1;
			}
			ans = max(ans, pr[0][tim]+pr[1][l]);
		}
		swap(n,m);
	}
	cout << ans << "\n";
}

Compilation message

dishes.cpp: In function 'int32_t main()':
dishes.cpp:20:10: warning: unused variable 'k' [-Wunused-variable]
   20 |  for(int k : {0,1}){
      |          ^
# Verdict Execution time Memory Grader output
1 Incorrect 119 ms 15940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 119 ms 15940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 119 ms 15940 KB Output isn't correct
2 Halted 0 ms 0 KB -