Submission #827684

#TimeUsernameProblemLanguageResultExecution timeMemory
827684SupersonicHorses (IOI15_horses)C++14
17 / 100
1567 ms28352 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; typedef long double ll; ll h[500001]; ll x[500001]; ll y[500001]; int n; int init(int N, int X[], int Y[]) { n=N; h[0]=X[0]; for(int i=0;i<n;i++){ x[i]=X[i]; y[i]=Y[i]; if(i>0)h[i]=(h[i-1]*x[i]); } ll m=0; for(int i=0;i<n;i++){ m=max(m,h[i]*y[i]); } return (long long)m%((long long)1e9); } int updateX(int pos, int val) { x[pos]=val; h[0]=x[0]; for(int i=1;i<n;i++){ if(i<pos)continue; h[i]=(h[i-1]*x[i]); } ll m=0; for(int i=0;i<n;i++){ m=max(m,h[i]*y[i]); } return (long long)m%((long long)1e9); } int updateY(int pos, int val) { y[pos]=val; ll m=0; for(int i=0;i<n;i++){ m=max(m,h[i]*y[i]); } return (long long)m%((long long)1e9); }

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:21:21: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   21 |  return (long long)m%((long long)1e9);
      |         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:35:21: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   35 |  return (long long)m%((long long)1e9);
      |         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:44:21: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   44 |  return (long long)m%((long long)1e9);
      |         ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#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...