Submission #310590

#TimeUsernameProblemLanguageResultExecution timeMemory
310590juggernautHorses (IOI15_horses)C++14
17 / 100
15 ms8448 KiB
#include"horses.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll x[1005],y[1005],n,mod=1e9+7;
ll solve(){
    ll res=0,i,cnt=1;
    double lg=0,ans=0;
    for(i=0;i<n;i++){
        cnt=(cnt*x[i])%mod;
        lg+=log2(x[i]);
        if(cnt*y[i]>res){
            ans=lg+log2(y[i]);
            res=(cnt*y[i])%mod;
        }
    }
    return res;
}
int init(int N,int X[],int Y[]){
	n=N;
	copy(X,X+n,x);
	copy(Y,Y+n,y);
	return solve();
}
int updateX(int pos,int val){
	x[pos]=val;
	return solve();
}
int updateY(int pos,int val){
    y[pos]=val;
	return solve();
}

Compilation message (stderr)

horses.cpp: In function 'll solve()':
horses.cpp:8:17: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
    8 |     double lg=0,ans=0;
      |                 ^~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:23:14: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   23 |  return solve();
      |         ~~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:27:14: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   27 |  return solve();
      |         ~~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:31:14: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   31 |  return solve();
      |         ~~~~~^~
#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...