Submission #658956

# Submission time Handle Problem Language Result Execution time Memory
658956 2022-11-15T15:16:10 Z pere_gil Catfish Farm (IOI22_fish) C++17
0 / 100
846 ms 2097152 KB
#include "fish.h"
#include "bits/stdc++.h"
using namespace std;
         
typedef long long ll;
     
ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w){
	int h=0;
	for(int i=0;i<m;i++) h=max(h,y[i]);
	h+=2;

	ll fish[n][h]={};
	for(int i=0;i<m;i++) fish[x[i]][y[i]+1]=w[i];
	for(int i=0;i<n;i++)
		for(int j=1;j<h;j++)
			fish[i][j]+=fish[i][j-1];

	ll dp[n][h][h][h]={};
	for(int i=1;i<n;i++){
		for(int j=0;j<h;j++){
			for(int k=0;k<h;k++){

				for(int l=0;l<h;l++)
					dp[i][j][k][l]=max(dp[i][j][k][l],dp[i-1][l][j][k]);

				for(int l=0;l<h;l++){
					if(k>=l) dp[i][j][k][l]+=fish[i][k]-fish[i][l];
					else dp[i][j][k][l]+=fish[i-1][max(j,l)]-fish[i-1][max(j,k)];
				}
			}
		}
	}
	
	ll res=0;
	for(int i=0;i<h;i++)
		for(int j=0;j<h;j++)
			for(int k=0;k<h;k++)
				res=max(res,dp[n-1][i][j][k]);
	
	return res;
}
# Verdict Execution time Memory Grader output
1 Runtime error 846 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 8128 KB Output is correct
2 Correct 13 ms 8024 KB Output is correct
3 Incorrect 31 ms 9500 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '17841087041964'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 8128 KB Output is correct
2 Correct 13 ms 8024 KB Output is correct
3 Incorrect 31 ms 9500 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '17841087041964'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 846 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -