Submission #692902

# Submission time Handle Problem Language Result Execution time Memory
692902 2023-02-02T07:06:28 Z Pyqe Catfish Farm (IOI22_fish) C++17
0 / 100
1000 ms 67228 KB
#include <bits/stdc++.h>
#include "fish.h"

using namespace std;

const long long inf=1e18;
long long aa[3069][3069],dp[3069][3069][2];
pair<pair<long long,long long>,long long> a[300069];

long long max_weights(int n,int m,vector<int> xa,vector<int> ya,vector<int> wg)
{
	long long i,j,x,y,w,mx,z=-inf;
	
	for(i=1;i<=m;i++)
	{
		x=xa[i-1]+1;
		y=ya[i-1]+1;
		w=wg[i-1];
		a[i]={{x,y},w};
		aa[x][y]=w;
	}
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=n;j++)
		{
			dp[i][j][0]=dp[i-1][j][0];
		}
		mx=-inf;
		for(j=n;j;j--)
		{
			mx=max(mx,dp[i-1][j][1]);
			dp[i][j][0]=max(dp[i][j][0],mx+aa[i][j]);
		}
		mx=-inf;
		for(j=1;j<=n;j++)
		{
			dp[i][j][0]=max(dp[i][j][0],mx+aa[i][j]);
			mx=max(mx,dp[i][j][0]);
		}
		if(i==1)
		{
			for(j=1;j<=n;j++)
			{
				dp[i][j][1]=-inf;
			}
		}
		else
		{
			for(j=1;j<=n;j++)
			{
				dp[i][j][1]=dp[i-1][j][1];
			}
			mx=-inf;
			for(j=1;j<=n;j++)
			{
				mx=max(mx,dp[i-2][j][0]);
				dp[i][j][1]=max(dp[i][j][1],mx+aa[i][j]);
			}
			mx=-inf;
			for(j=n;j;j--)
			{
				dp[i][j][1]=max(dp[i][j][1],mx+aa[i][j]);
				mx=max(mx,dp[i][j][1]);
			}
		}
	}
	for(i=1;i<=n;i++)
	{
		z=max(z,max(dp[n][i][1],dp[n-1][i][0]));
	}
	return z;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 66404 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Execution timed out 1071 ms 67228 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 55724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Incorrect 2 ms 1876 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Incorrect 2 ms 1876 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 300 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Incorrect 2 ms 1876 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 55724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 66404 KB Time limit exceeded
2 Halted 0 ms 0 KB -