제출 #206295

#제출 시각아이디문제언어결과실행 시간메모리
206295okoHorses (IOI15_horses)C++14
17 / 100
1581 ms12152 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;
    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();
}

컴파일 시 표준 에러 (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:17: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:38: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:43: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:48: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...