답안 #684881

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
684881 2023-01-22T18:13:38 Z Konti2 메기 농장 (IOI22_fish) C++17
14 / 100
1000 ms 5168 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; 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;
}
		  
*/ 

# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1100 ms 2952 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Execution timed out 1097 ms 5168 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1095 ms 452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 13 ms 1640 KB Output is correct
10 Correct 82 ms 3172 KB Output is correct
11 Correct 11 ms 1676 KB Output is correct
12 Correct 81 ms 3032 KB Output is correct
13 Correct 2 ms 984 KB Output is correct
14 Correct 81 ms 3116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 13 ms 1640 KB Output is correct
10 Correct 82 ms 3172 KB Output is correct
11 Correct 11 ms 1676 KB Output is correct
12 Correct 81 ms 3032 KB Output is correct
13 Correct 2 ms 984 KB Output is correct
14 Correct 81 ms 3116 KB Output is correct
15 Incorrect 84 ms 3040 KB 1st lines differ - on the 1st token, expected: '299', found: '9'
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 13 ms 1640 KB Output is correct
10 Correct 82 ms 3172 KB Output is correct
11 Correct 11 ms 1676 KB Output is correct
12 Correct 81 ms 3032 KB Output is correct
13 Correct 2 ms 984 KB Output is correct
14 Correct 81 ms 3116 KB Output is correct
15 Incorrect 84 ms 3040 KB 1st lines differ - on the 1st token, expected: '299', found: '9'
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1095 ms 452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1100 ms 2952 KB Time limit exceeded
2 Halted 0 ms 0 KB -