Submission #342640

#TimeUsernameProblemLanguageResultExecution timeMemory
342640monus1042Horses (IOI15_horses)C++17
17 / 100
54 ms20176 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> ii; int n; vector<int> x, y; int dp[11][1001]; int f(int pos, int factor){ if (pos == n) return 0; int &answer = dp[pos][factor]; if (answer > -1) return answer; int horses = factor * x[pos]; for (int i=0; i<=horses; i++){ int delta = i * y[pos]; answer = max(answer, f(pos+1, horses - i) + delta); } return answer; } int init(int N, int X[], int Y[]) { n = N; for (int i=0; i<n; i++) x.push_back(X[i]), y.push_back(Y[i]); memset(dp, -1, sizeof dp); return f(0, 1); } int updateX(int pos, int val) { return 0; } int updateY(int pos, int val) { return 0; }

Compilation message (stderr)

horses.cpp: In function 'int updateX(int, int)':
horses.cpp:31:17: warning: unused parameter 'pos' [-Wunused-parameter]
   31 | int updateX(int pos, int val) {
      |             ~~~~^~~
horses.cpp:31:26: warning: unused parameter 'val' [-Wunused-parameter]
   31 | int updateX(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:35:17: warning: unused parameter 'pos' [-Wunused-parameter]
   35 | int updateY(int pos, int val) {
      |             ~~~~^~~
horses.cpp:35:26: warning: unused parameter 'val' [-Wunused-parameter]
   35 | int updateY(int pos, int val) {
      |                      ~~~~^~~
#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...