Submission #234971

#TimeUsernameProblemLanguageResultExecution timeMemory
234971anubhavdharHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.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; int L_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 init(int N, int* X, int* Y) { ll amt = 0, prod = 1; F0R(i, N) { prod *= X[i]; amt = max(amt, prod*Y[i]); } return amt; } 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 L_init(int, int*, int*)':
horses.cpp:55:18: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return dp[N-1][0];
         ~~~~~~~~~^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:67:9: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return amt;
         ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:70:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateX(int pos, int val){return 0;}
                 ^~~
horses.cpp:70: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:71:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateY(int pos, int val){return 0;}
                 ^~~
horses.cpp:71:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateY(int pos, int val){return 0;}
                          ^~~
/tmp/ccLmfdkW.o: In function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'
/tmp/ccEDcqs4.o:horses.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status