Submission #591313

# Submission time Handle Problem Language Result Execution time Memory
591313 2022-07-07T09:09:08 Z 장태환(#8418) Two Dishes (JOI19_dishes) C++17
5 / 100
160 ms 24144 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int psuma[200100];
int psumb[200100];
int lima[200100], limb[200100];
int vala[200100], valb[200100];
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N, M;
	cin >> N >> M;
	int i;
	for (i = 0; i < N; i++)
	{
		cin >> psuma[i+1];
		cin >> lima[i];
		cin >> vala[i+1];
		vala[i + 1] += vala[i];
		if (i)
			psuma[i+1] += psuma[i];
	}
	for (i = 0; i < M; i++)
	{
		cin >> psumb[i+1];
		cin >> limb[i];
		cin >> valb[i+1];
		valb[i + 1] += valb[i];
		if (i)
			psumb[i+1] += psumb[i];
	}
	int l = M;
	int ans = -(1LL<<60);
	for (i = 0; i <= N; i++)
	{
		while (l >= 0 && psumb[l]+psuma[i] > limb[0])
		{
			l--;
		}
		if (l >= 0)
			ans = max(ans,vala[i]+ valb[l]);
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 139 ms 9696 KB Output is correct
2 Correct 160 ms 23396 KB Output is correct
3 Correct 138 ms 23052 KB Output is correct
4 Correct 152 ms 23372 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 141 ms 22720 KB Output is correct
7 Correct 74 ms 11832 KB Output is correct
8 Correct 72 ms 11980 KB Output is correct
9 Correct 153 ms 24144 KB Output is correct
10 Correct 125 ms 16992 KB Output is correct
11 Correct 107 ms 17480 KB Output is correct
# 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 Correct 139 ms 9696 KB Output is correct
2 Correct 160 ms 23396 KB Output is correct
3 Correct 138 ms 23052 KB Output is correct
4 Correct 152 ms 23372 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 141 ms 22720 KB Output is correct
7 Correct 74 ms 11832 KB Output is correct
8 Correct 72 ms 11980 KB Output is correct
9 Correct 153 ms 24144 KB Output is correct
10 Correct 125 ms 16992 KB Output is correct
11 Correct 107 ms 17480 KB Output is correct
12 Incorrect 0 ms 340 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 139 ms 9696 KB Output is correct
2 Correct 160 ms 23396 KB Output is correct
3 Correct 138 ms 23052 KB Output is correct
4 Correct 152 ms 23372 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 141 ms 22720 KB Output is correct
7 Correct 74 ms 11832 KB Output is correct
8 Correct 72 ms 11980 KB Output is correct
9 Correct 153 ms 24144 KB Output is correct
10 Correct 125 ms 16992 KB Output is correct
11 Correct 107 ms 17480 KB Output is correct
12 Incorrect 0 ms 340 KB Output isn't correct
13 Halted 0 ms 0 KB -