Submission #1088720

#TimeUsernameProblemLanguageResultExecution timeMemory
1088720gustavo_dHorses (IOI15_horses)C++17
17 / 100
1573 ms8284 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; const int MX_COW=1000; const int MAXN = 500000; int n; vector<int> x(MAXN), y(MAXN); int init(int N, int X[], int Y[]) { n = N+1; 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) { x[pos+1] = val; 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 updateY(int pos, int val) { y[pos+1] = val; int ans = 0; int qtd = 1; for (int i=1; i<n; i++) { qtd *= x[i]; ans = max(ans, qtd * y[i]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...