Submission #234191

#TimeUsernameProblemLanguageResultExecution timeMemory
234191jhtanHorses (IOI15_horses)C++14
17 / 100
1585 ms16232 KiB
#include "horses.h" #include <algorithm> using namespace std; typedef long long ll; const ll MOD = 1000000007; ll V[500000]; ll XX[500000]; ll YY[500000]; int n; int init(int N, int X[], int Y[]) { // For 17 points /* int V[N]; V[0] = X[0]; for(int i=1; i<N; i++) V[i] = V[i-1] * X[i]; int mx = 0; for(int i=0; i<N; i++) mx = max(mx, V[i] * Y[i]); */ n = N; for(int i=0; i<N; i++) { YY[i] = Y[i]; XX[i] = X[i]; } V[0] = X[0]; for(int i=1; i<N; i++) V[i] = (V[i-1] * X[i]) % MOD; ll mx = 0; for(int i=0; i<N; i++) mx = max(mx, (V[i] * Y[i])); return mx % MOD; } int updateX(int pos, int val) { XX[pos] = val; for(int i=pos; i<n; i++) V[i] = (V[i-1] * XX[i]) % MOD; ll mx = 0; for(int i=0; i<n; i++) mx = max(mx, (V[i] * YY[i])); return mx % MOD; } int updateY(int pos, int val) { YY[pos] = val; ll mx = 0; for(int i=0; i<n; i++) mx = max(mx, (V[i] * YY[i])); return mx % MOD; }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:37:12: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return mx % MOD;
         ~~~^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:45:12: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return mx % MOD;
         ~~~^~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:52:12: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
  return mx % 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...