Submission #500999

#TimeUsernameProblemLanguageResultExecution timeMemory
500999AmirElarbiHorses (IOI15_horses)C++14
17 / 100
13 ms10536 KiB
#include <bits/stdc++.h> #include "horses.h" #define vi vector<int> #define ve vector #define ll long long #define vf vector<float> #define vll vector<pair<ll,ll>> #define ii pair<int,int> #define vvi vector<vi> #define vii vector<ii> #define gii greater<ii> #define pb push_back #define mp make_pair #define fi first #define se second #define INF 1e9 #define eps 1e-7 #define eps1 1e-25 #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define MAX_A 1e5+5 #define V 450 using namespace std; const int MOD = 1e9+7; ll x[1005],y[1005]; ll dp[1005]; int n; ll srch(int i, ll nb){ if(i == n) return 0; if(dp[i]!=-1)return dp[i]; return dp[i] = max(srch(i+1,(nb%MOD*x[i]%MOD)%MOD)%MOD, ((nb%MOD*x[i]%MOD)%MOD*y[i])%MOD); } int init(int N, int X[], int Y[]) { n = N; memset(dp,-1,sizeof dp); for (int i = 0; i < n; ++i) { x[i] = X[i]; y[i] = Y[i]; } return srch(0,1)%MOD; } int updateX(int pos, int val) { x[pos] = val; memset(dp,-1,sizeof dp); return srch(0,1)%MOD; } int updateY(int pos, int val) { y[pos] = val; memset(dp,-1,sizeof dp); return srch(0,1)%MOD; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:40:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   40 |  return srch(0,1)%MOD;
      |         ~~~~~~~~~^~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:46:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   46 |  return srch(0,1)%MOD;
      |         ~~~~~~~~~^~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:52:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   52 |  return srch(0,1)%MOD;
      |         ~~~~~~~~~^~~~
#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...