Submission #684880

# Submission time Handle Problem Language Result Execution time Memory
684880 2023-01-22T18:12:07 Z Konti2 Catfish Farm (IOI22_fish) C++17
14 / 100
1000 ms 5276 KB
#include <bits/stdc++.h>
#include "fish.h"

using namespace std;

using ll = long long;

ll t[301][301];
ll dp[301][301][2];
ll sum[301][301];

ll max_weights(int N, int M, vector<int> x, vector<int> y, vector<int> w){
	  ll ans = 0;
	  for (int i = 0; i < M; i++){
		  t[x[i]][y[i]] = w[i];
	  }
	  for (int i = 0; i < N; i++){
		  for (int h = 1; h <= 9; h++){
			  sum[i][h] = t[i][h-1] + sum[i][h-1];
		  }
		  if (!i) continue;
		  for (int a = 0; a <= N; a++){
			if (i > 0){
				for (int b = 0; b < a; b++){
					dp[i][a][1] = max(dp[i][a][1], dp[i-1][b][1] + (sum[i-1][a] - sum[i-1][b]));
				}
				for (int b = a+1; b <= N; b++){
					dp[i][a][0] = max(dp[i][a][0], max(dp[i-1][b][0], dp[i-1][b][1]) + (sum[i][b] - sum[i][a]));
				}
			}
			if (i > 1){
				for (int c = 0; c <= N; c++){
					dp[i][a][1] = max(dp[i][a][1], max(dp[i-2][c][0], dp[i-2][c][1]) + sum[i-1][max(a,c)]);
				}
			}
			ans = max(ans, max(dp[i][a][0], dp[i][a][1]));
			
		}
	}
			 
			  
						  
	  
	  return ans;
  }
	
	
/*int main(){
	int n;
	cin >> n;
	int m;
	cin >> m;
	vector<int> x(m);
	vector<int> y(m);
	vector<int> w(m);
	for (int i = 0; i < m; i++){
		cin >> x[i];
		cin >> y[i];
		cin >> w[i];
	}
	cout << max_weights(n, m, x, y, w);
	return 0;
}
		  
*/ 

# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 3496 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 Execution timed out 1063 ms 5276 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 364 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 13 ms 1620 KB Output is correct
10 Correct 88 ms 3204 KB Output is correct
11 Correct 11 ms 1620 KB Output is correct
12 Correct 88 ms 3148 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 84 ms 3212 KB Output is correct
# 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 13 ms 1620 KB Output is correct
10 Correct 88 ms 3204 KB Output is correct
11 Correct 11 ms 1620 KB Output is correct
12 Correct 88 ms 3148 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 84 ms 3212 KB Output is correct
15 Incorrect 89 ms 3060 KB 1st lines differ - on the 1st token, expected: '299', found: '9'
16 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 13 ms 1620 KB Output is correct
10 Correct 88 ms 3204 KB Output is correct
11 Correct 11 ms 1620 KB Output is correct
12 Correct 88 ms 3148 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 84 ms 3212 KB Output is correct
15 Incorrect 89 ms 3060 KB 1st lines differ - on the 1st token, expected: '299', found: '9'
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 364 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 3496 KB Time limit exceeded
2 Halted 0 ms 0 KB -