제출 #134189

#제출 시각아이디문제언어결과실행 시간메모리
134189Runtime_error_Horses (IOI15_horses)C++14
17 / 100
18 ms9336 KiB
#include "horses.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf = 1e3+9,mod = 1e9+7;
ll n,dp[inf],x[inf],y[inf];

int calc(){
/*
    ll cur = 1,ret = 0;
	for(int i=1;i<=n;i++){
        dp[i] = 0;
        cur = 1;
        for(int j=i;j>0;j--){
            cur = (cur*x[j])%mod;
            dp[i] = max(dp[i], (mod+dp[j-1]-y[j-1] + (cur*y[i])%mod)%mod );
        }

        ret = max( ret ,dp[i] );
        //cout<<dp[i]<<" ";
	}
	return (int)ret;*/
	ll cur = 1,ret = 0;
	for(int i=1;i<=n;i++){
        cur = (cur*x[i])%mod;
        ret = max(ret , (cur*y[i])%mod );
	}
	return ret;

}

int init(int N, int X[], int Y[]) {
    n = N;
    for(int i=1;i<=N;i++)
        x[i] = X[i-1] , y[i] = Y[i-1];

    return calc();
}

int updateX(int pos, int val) {
    pos++;
    x[pos] = val;
    return calc();
}

int updateY(int pos, int val) {
    pos++;
    y[pos] = val;
	return calc();
}

컴파일 시 표준 에러 (stderr) 메시지

horses.cpp: In function 'int calc()':
horses.cpp:28:9: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
  return ret;
         ^~~
#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...