Submission #591915

#TimeUsernameProblemLanguageResultExecution timeMemory
591915l_rehoHorses (IOI15_horses)C++14
17 / 100
215 ms524288 KiB
#include "horses.h" #include <stdio.h> #include <stdlib.h> static char _buffer[1024]; static int _currentChar = 0; static int _charsNumber = 0; static FILE *_inputFile, *_outputFile; #include <bits/stdc++.h> using namespace std; vector<vector<long long>> dp; int init(int N, int X[], int Y[]) { dp.assign(N, vector<long long>(1000, 0)); vector<long long> pref(N+1, 0); pref[0] = 1; for(int i = 1; i <= N; i++) pref[i] = pref[i-1] * X[i-1]; for(int i = 0; i <= pref[1]; i++) dp[0][i] = Y[0] * (pref[1]-i); for(int i = 1; i < N; i++){ for(int h = 0; h <= pref[i]; h++){ for(int k = 0; k <= X[i]*h; k++){ dp[i][X[i]*h-k] = max(dp[i][X[i]*h-k], dp[i-1][h] + k*Y[i]); } } } long long ans = 0; for(int i = 0; i <= pref[N]; i++){ ans = max(ans, dp[N-1][i]); } return ans; } int updateX(int pos, int val) { return 0; } int updateY(int pos, int val) { return 0; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:45:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   45 |  return ans;
      |         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:48:17: warning: unused parameter 'pos' [-Wunused-parameter]
   48 | int updateX(int pos, int val) {
      |             ~~~~^~~
horses.cpp:48:26: warning: unused parameter 'val' [-Wunused-parameter]
   48 | int updateX(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:52:17: warning: unused parameter 'pos' [-Wunused-parameter]
   52 | int updateY(int pos, int val) {
      |             ~~~~^~~
horses.cpp:52:26: warning: unused parameter 'val' [-Wunused-parameter]
   52 | int updateY(int pos, int val) {
      |                      ~~~~^~~
horses.cpp: At global scope:
horses.cpp:8:27: warning: '_outputFile' defined but not used [-Wunused-variable]
    8 | static FILE *_inputFile, *_outputFile;
      |                           ^~~~~~~~~~~
horses.cpp:8:14: warning: '_inputFile' defined but not used [-Wunused-variable]
    8 | static FILE *_inputFile, *_outputFile;
      |              ^~~~~~~~~~
horses.cpp:7:12: warning: '_charsNumber' defined but not used [-Wunused-variable]
    7 | static int _charsNumber = 0;
      |            ^~~~~~~~~~~~
horses.cpp:6:12: warning: '_currentChar' defined but not used [-Wunused-variable]
    6 | static int _currentChar = 0;
      |            ^~~~~~~~~~~~
horses.cpp:5:13: warning: '_buffer' defined but not used [-Wunused-variable]
    5 | static char _buffer[1024];
      |             ^~~~~~~
#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...