Submission #206296

#TimeUsernameProblemLanguageResultExecution timeMemory
206296okoHorses (IOI15_horses)C++14
17 / 100
1589 ms12132 KiB
#include "horses.h" #include <stdio.h> #include <stdlib.h> #include <bits/stdc++.h> using namespace std; long long n,a[500500],b[500500],mod=1e9+7; long long slov() { long long x=1,ans=0,st; for(int i=n-1;i>=0;i--) { x*=a[i]; st=i; if(x>(long long)2e9)break; } x=1; if(st)ans=b[st-1]; for(int i=st;i<n;i++) { x*=a[i]; ans=max(ans,x*b[i]); } ans%=mod; for(int i=0;i<st;i++) { ans*=a[i]; ans%=mod; } return ans; } int init(int N, int X[], int Y[]) { n=N; for(int i=0;i<n;i++) { a[i]=X[i]; b[i]=Y[i]; } return slov(); } int updateX(int pos, int val) { a[pos]=val; return slov(); } int updateY(int pos, int val) { b[pos]=val; return slov(); }

Compilation message (stderr)

horses.cpp: In function 'long long int slov()':
horses.cpp:10:16: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     for(int i=n-1;i>=0;i--)
               ~^~
horses.cpp:18:15: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     for(int i=st;i<n;i++)
               ^~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:39:16: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return slov();
            ~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:44:16: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return slov();
            ~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:49:16: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     return slov();
            ~~~~^~
#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...