Submission #132468

#TimeUsernameProblemLanguageResultExecution timeMemory
132468redaHorses (IOI15_horses)C++14
17 / 100
18 ms8440 KiB
#include<bits/stdc++.h>
using namespace std ;
#define  MOD 1000000007
# include "horses.h"
int X[1005],Y[1005],N;
int init(int n, int x[], int y[])
{
  N=n;
  for(int i=0;i<N;i++)
    X[i]=x[i],Y[i]=y[i];
    long long h=1,ans=0;
	for(int i=0;i<n;i++)
    {
        h*=x[i];
      h=h%MOD;
        ans=max((h*y[i])%MOD,ans);
    }
    return ans%MOD;
}
int updateX(int pos, int val)
{
  X[pos]=val;
  return init(N,X,Y);
}
int updateY(int pos, int val)
{
 Y[pos]=val;
  return init(N,X,Y);
}

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:9:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for(int i=0;i<N;i++)
   ^~~
horses.cpp:11:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     long long h=1,ans=0;
     ^~~~
horses.cpp:18:15: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return ans%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...