Submission #684882

# Submission time Handle Problem Language Result Execution time Memory
684882 2023-01-22T18:14:59 Z Konti2 Catfish Farm (IOI22_fish) C++17
35 / 100
1000 ms 6684 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 <= N; 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; 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 1087 ms 3816 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 1086 ms 5572 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1816 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 15 ms 1620 KB Output is correct
10 Correct 89 ms 3056 KB Output is correct
11 Correct 12 ms 1620 KB Output is correct
12 Correct 81 ms 3072 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 86 ms 3132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 15 ms 1620 KB Output is correct
10 Correct 89 ms 3056 KB Output is correct
11 Correct 12 ms 1620 KB Output is correct
12 Correct 81 ms 3072 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 86 ms 3132 KB Output is correct
15 Correct 100 ms 3036 KB Output is correct
16 Correct 4 ms 980 KB Output is correct
17 Correct 99 ms 4660 KB Output is correct
18 Correct 94 ms 4532 KB Output is correct
19 Correct 93 ms 4904 KB Output is correct
20 Correct 97 ms 4812 KB Output is correct
21 Correct 104 ms 5028 KB Output is correct
22 Correct 106 ms 6684 KB Output is correct
23 Correct 83 ms 3424 KB Output is correct
24 Correct 91 ms 4248 KB Output is correct
25 Correct 83 ms 3096 KB Output is correct
26 Correct 87 ms 3328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 15 ms 1620 KB Output is correct
10 Correct 89 ms 3056 KB Output is correct
11 Correct 12 ms 1620 KB Output is correct
12 Correct 81 ms 3072 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 86 ms 3132 KB Output is correct
15 Correct 100 ms 3036 KB Output is correct
16 Correct 4 ms 980 KB Output is correct
17 Correct 99 ms 4660 KB Output is correct
18 Correct 94 ms 4532 KB Output is correct
19 Correct 93 ms 4904 KB Output is correct
20 Correct 97 ms 4812 KB Output is correct
21 Correct 104 ms 5028 KB Output is correct
22 Correct 106 ms 6684 KB Output is correct
23 Correct 83 ms 3424 KB Output is correct
24 Correct 91 ms 4248 KB Output is correct
25 Correct 83 ms 3096 KB Output is correct
26 Correct 87 ms 3328 KB Output is correct
27 Runtime error 2 ms 596 KB Execution killed with signal 11
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 1816 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 3816 KB Time limit exceeded
2 Halted 0 ms 0 KB -