Submission #579485

# Submission time Handle Problem Language Result Execution time Memory
579485 2022-06-19T08:51:19 Z 장태환(#8353) Triple Jump (JOI19_jumps) C++17
19 / 100
1432 ms 211056 KB
#include <bits/stdc++.h>
using namespace std;
int ps[5010][5010];
int arr[5010];
int ips[5010][5010];
int iips[5010][5010];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int N;
	cin >> N;
	int i;
	for (i = 0; i < N; i++)
	{
		cin >> arr[i];
	}
	for (i = 0; i < N; i++)
	{
		int e = i+1;
		int j;
		int cma = -(1<<30);
		for (j = i; j < N; j++)
		{
			if (e - i <= j - e)
			{
				e++;
				cma = max(cma, arr[e - 1]);
			}
			ps[i][j] = cma+arr[i]+arr[j];
		}
	}
	for (i = 0; i < N; i++)
	{
		ips[i][i] = ps[i][i];
		int j;
		for (j = i + 1; j < N; j++)
		{
			ips[i][j] = max(ps[i][j], ips[i][j - 1]);
		}
	}
	for (i = 0; i < N; i++)
	{
		iips[i][i] = ips[i][i];
		int j;
		for (j = i-1; j >=0; j--)
		{
			iips[j][i] = max(ips[j][i], iips[j+1][i]);
		}
	}
	int Q;
	cin >> Q;
	while (Q--)
	{
		int a, b;
		cin >> a >> b;
		cout << iips[a - 1][b - 1] << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 1 ms 1612 KB Output is correct
4 Correct 1 ms 1620 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 1 ms 1612 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1612 KB Output is correct
10 Correct 2 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 1 ms 1612 KB Output is correct
4 Correct 1 ms 1620 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 1 ms 1612 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1612 KB Output is correct
10 Correct 2 ms 1620 KB Output is correct
11 Correct 667 ms 210964 KB Output is correct
12 Correct 618 ms 210916 KB Output is correct
13 Correct 588 ms 210980 KB Output is correct
14 Correct 594 ms 210996 KB Output is correct
15 Correct 567 ms 211052 KB Output is correct
16 Correct 579 ms 210408 KB Output is correct
17 Correct 590 ms 210308 KB Output is correct
18 Correct 591 ms 210252 KB Output is correct
19 Correct 583 ms 211056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 1432 ms 201352 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 1492 KB Output is correct
3 Correct 1 ms 1612 KB Output is correct
4 Correct 1 ms 1620 KB Output is correct
5 Correct 2 ms 1616 KB Output is correct
6 Correct 2 ms 1620 KB Output is correct
7 Correct 1 ms 1612 KB Output is correct
8 Correct 2 ms 1492 KB Output is correct
9 Correct 2 ms 1612 KB Output is correct
10 Correct 2 ms 1620 KB Output is correct
11 Correct 667 ms 210964 KB Output is correct
12 Correct 618 ms 210916 KB Output is correct
13 Correct 588 ms 210980 KB Output is correct
14 Correct 594 ms 210996 KB Output is correct
15 Correct 567 ms 211052 KB Output is correct
16 Correct 579 ms 210408 KB Output is correct
17 Correct 590 ms 210308 KB Output is correct
18 Correct 591 ms 210252 KB Output is correct
19 Correct 583 ms 211056 KB Output is correct
20 Runtime error 1432 ms 201352 KB Execution killed with signal 11
21 Halted 0 ms 0 KB -