Submission #658831

# Submission time Handle Problem Language Result Execution time Memory
658831 2022-11-15T02:54:54 Z pere_gil Catfish Farm (IOI22_fish) C++17
23 / 100
1000 ms 2097152 KB
#include "fish.h"
#include "bits/stdc++.h"
using namespace std;
     
typedef long long ll;

int n,h;
vector<vector<vector<ll>>> dp;
vector<vector<ll>> fish;

ll f(int x, int j, int k){
	if(x<0) return 0;
	if(dp[x][j][k]!=-1) return dp[x][j][k];

	ll res=0;
	for(int i=0;i<h;i++){
		ll act=f(x-1,i,j);

		if(i<j) act+=fish[x][j]-fish[x][i];
		else act+=(x==n-1) ? 0 : fish[x+1][max(i,k)]-fish[x+1][max(j,k)];

		res=max(res,act);
	}
	return dp[x][j][k]=res;
}

ll max_weights(int N, int m, vector<int> x, vector<int> y, vector<int> w){
	n=N;
	h=0;
	for(int i=0;i<m;i++) h=max(h,y[i]);
	h+=2;

	fish.assign(n,vector<ll>(h,0));
	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];

	dp.assign(n,vector<vector<ll>>(h,vector<ll>(h,-1)));
	
	return f(n-1,0,0);
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 2097152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 800 ms 2097152 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 31564 KB Output is correct
2 Correct 38 ms 31604 KB Output is correct
3 Correct 55 ms 30616 KB Output is correct
4 Correct 50 ms 33100 KB Output is correct
5 Correct 66 ms 35532 KB Output is correct
6 Correct 57 ms 34912 KB Output is correct
7 Correct 70 ms 35380 KB Output is correct
8 Correct 78 ms 35448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 216 KB Output is correct
3 Correct 1 ms 220 KB Output is correct
4 Correct 1 ms 220 KB Output is correct
5 Correct 1 ms 224 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 320 KB Output is correct
10 Correct 3 ms 724 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 3 ms 600 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 216 KB Output is correct
3 Correct 1 ms 220 KB Output is correct
4 Correct 1 ms 220 KB Output is correct
5 Correct 1 ms 224 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 320 KB Output is correct
10 Correct 3 ms 724 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 3 ms 600 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 564 KB Output is correct
15 Execution timed out 1093 ms 216548 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 216 KB Output is correct
3 Correct 1 ms 220 KB Output is correct
4 Correct 1 ms 220 KB Output is correct
5 Correct 1 ms 224 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 2 ms 320 KB Output is correct
10 Correct 3 ms 724 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 3 ms 600 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 564 KB Output is correct
15 Execution timed out 1093 ms 216548 KB Time limit exceeded
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 31564 KB Output is correct
2 Correct 38 ms 31604 KB Output is correct
3 Correct 55 ms 30616 KB Output is correct
4 Correct 50 ms 33100 KB Output is correct
5 Correct 66 ms 35532 KB Output is correct
6 Correct 57 ms 34912 KB Output is correct
7 Correct 70 ms 35380 KB Output is correct
8 Correct 78 ms 35448 KB Output is correct
9 Runtime error 793 ms 2097152 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 2097152 KB Time limit exceeded
2 Halted 0 ms 0 KB -