Submission #1088718

# Submission time Handle Problem Language Result Execution time Memory
1088718 2024-09-14T21:50:25 Z gustavo_d Horses (IOI15_horses) C++17
Compilation error
0 ms 0 KB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;

const int MX_COW=1000;

int init(int N, int X[], int Y[]) {
	int n = N+1;
	vector<int> x(n), y(n);
	for (int i=1; i<n; i++) x[i] = X[i-1];
	for (int i=1; i<n; i++) y[i] = Y[i-1];

	int ans = 0;
	int qtd = 1;
	for (int i=1; i<n; i++) {
		qtd *= x[i];
		ans = max(ans, qtd * y[i]);
	}
	return ans;
	// int dp[n][MX_COW+1];
	// for (int i=1; i<=MX_COW; i++) {
	// 	dp[0][i] = -1e9;
	// }
	// dp[0][1] = 0;
	// for (int i=1; i<n; i++) {
	// 	for (int cow=0; cow<=MX_COW; cow++) {
	// 		dp[i][cow] = -1e9;
	// 		for (int v=0; v<=MX_COW; v++) {
	// 			if ((cow+v)/x[i] > MX_COW) continue;
	// 			if ((cow+v) % x[i] != 0) continue;
	// 			dp[i][cow] = max(
	// 				dp[i][cow],
	// 				dp[i-1][(cow + v) / x[i]] + v * y[i]
	// 			);
	// 		}
	// 	}
	// }
	return dp[n-1][0];
}

int updateX(int pos, int val) {	
	return 0;
}

int updateY(int pos, int val) {
	return 0;
}

Compilation message

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:38:9: error: 'dp' was not declared in this scope
   38 |  return dp[n-1][0];
      |         ^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:41:17: warning: unused parameter 'pos' [-Wunused-parameter]
   41 | int updateX(int pos, int val) {
      |             ~~~~^~~
horses.cpp:41:26: warning: unused parameter 'val' [-Wunused-parameter]
   41 | int updateX(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:45:17: warning: unused parameter 'pos' [-Wunused-parameter]
   45 | int updateY(int pos, int val) {
      |             ~~~~^~~
horses.cpp:45:26: warning: unused parameter 'val' [-Wunused-parameter]
   45 | int updateY(int pos, int val) {
      |                      ~~~~^~~