Submission #206126

#TimeUsernameProblemLanguageResultExecution timeMemory
206126awlintqaaHorses (IOI15_horses)C++14
17 / 100
563 ms10360 KiB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0) #include <bits/stdc++.h> using namespace std; #define sqr 200 #define mid (l+r)/2 #define pb push_back #define ppb pop_back #define fi first #define se second #define lb lower_bound #define ub upper_bound #define ins insert #define era erase #define C continue #define mem(dp,i) memset(dp,i,sizeof(dp)) #define mset multiset typedef long long ll; typedef short int si; typedef long double ld; typedef pair<int,int> pi; typedef pair<ll,ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pi> vpi; typedef vector<pll> vpll; const ll mod=1e9+7; const ll inf= 4e18; const ld pai=acos(-1); #include "horses.h" ll n ; ll a[100009] , cost [100009]; ll dp[19][1009]; ll bt(ll id,ll num){ if ( id== n )return 0; ll &ret=dp[id][num]; if ( ret !=-1 )return ret; ret =0 ; num *= a[id]; for ( int i =0 ;i <= num ;i ++ ){ ret = max ( ret ,bt (id+1, num - i ) + i * (cost[id]%mod) ); ret %= mod; } return ret; } int init(int N, int X[], int Y[]) { mem ( dp ,-1 ); n = N; for ( int i =0 ;i < n ;i ++ ) a[i]=X[i]; for ( int i =0 ;i < n ;i ++ ) cost [i] = Y [i]; return bt(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 init(int, int*, int*)':
horses.cpp:50:18: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
         return bt(0,1);
                ~~^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:52:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateX(int pos, int val) {
                 ^~~
horses.cpp:52:26: warning: unused parameter 'val' [-Wunused-parameter]
 int updateX(int pos, int val) {
                          ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:56:17: warning: unused parameter 'pos' [-Wunused-parameter]
 int updateY(int pos, int val) {
                 ^~~
horses.cpp:56:26: warning: unused parameter 'val' [-Wunused-parameter]
 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...