Submission #234746

#TimeUsernameProblemLanguageResultExecution timeMemory
234746anubhavdharHorses (IOI15_horses)C++14
17 / 100
32 ms10752 KiB
#include<bits/stdc++.h> #include "horses.h" #define ll long long int #define pb push_back #define mp make_pair #define FOR(i,n) for(i=0;i<(n);++i) #define FORe(i,n) for(i=1;i<=(n);++i) #define FORr(i,a,b) for(i=(a);i<(b);++i) #define FORrev(i,n) for(i=(n);i>=0;--i) #define F0R(i,n) for(int i=0;i<(n);++i) #define F0Re(i,n) for(int i=1;i<=(n);++i) #define F0Rr(i,a,b) for(ll i=(a);i<(b);++i) #define F0Rrev(i,n) for(int i=(n);i>=0;--i) #define ii pair<ll,ll> #define vi vector<ll> #define vii vector<ii> #define ff first #define ss second #define cd complex<double> #define vcd vector<cd> #define ldd long double #define dbgLine cout<<"Line : "<<__LINE__<<'\n' #define all(x) (x).begin(),(x).end() using namespace std; /* const short int __PRECISION = 10; const ll MOD = 1e9+7; const ll INF = 1e17 + 1101; const ll LOGN = 17; const ll MAXN = 2e5+5; const ll ROOTN = 320; const ldd PI = acos(-1); const ldd EPS = 1e-7;*/ #define INF 1000000000000001 int init(int N, int* X, int* Y) { ll dp[10][2000],prod = 1; F0R(i, N) prod *= X[i]; F0R(i, prod + 1) dp[0][i] = (i > X[0] ? -INF : (X[0] - i)*Y[0]); F0Re(i, N-1) F0R(j, prod + 1) { dp[i][j] = -INF; F0R(k, prod + 1) if(Y[i]*1LL*(X[i]*k - j) >= 0LL) dp[i][j] = max(dp[i][j], dp[i-1][k] + Y[i]*1LL*(X[i]*k - j)); } // F0R(i, N) // F0R(j, prod) // cout<<"dp["<<i<<"]["<<j<<"] = "<<dp[i][j]<<'\n'; return dp[N-1][0]; } int updateX(int pos, int val){return 0;} int updateY(int pos, int val){return 0;} /* int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int N, X[10], Y[10]; cin>>N; F0R(i, N) cin>>X[i]; F0R(i, N) cin>>Y[i]; cout<<init(N, X, Y); return 0; }*/

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:58:18: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return dp[N-1][0];
         ~~~~~~~~~^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:61:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateX(int pos, int val){return 0;}
                 ^~~
horses.cpp:61:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateX(int pos, int val){return 0;}
                          ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:62:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateY(int pos, int val){return 0;}
                 ^~~
horses.cpp:62:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateY(int pos, int val){return 0;}
                          ^~~
#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...