Submission #609802

#TimeUsernameProblemLanguageResultExecution timeMemory
609802jairRS말 (IOI15_horses)C++17
17 / 100
15 ms10492 KiB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

const int MAXN = 1000;
const ll MOD = 1e9 + 7;
int gN, gX[MAXN], gY[MAXN];

int getAns(){
	ll curAns = gY[gN - 1] * gX[gN - 1];
	for (int i = gN - 2; i >= 0; i--)
	{
		if(gY[i] > curAns)
			curAns = gY[i] * gX[i];
		else
			curAns *= gX[i];
	}
	return curAns;
}

int init(int N, int X[], int Y[]) {
	gN = N;
	for (int i = 0; i < N; i++)
	{
		gX[i] = X[i];
		gY[i] = Y[i];
	}
	
	return getAns();
}

int updateX(int pos, int val) {	
	gX[pos] = val;
	return getAns();
}

int updateY(int pos, int val) {
	gY[pos] = val;
	return getAns();
}

Compilation message (stderr)

horses.cpp: In function 'int getAns()':
horses.cpp:19:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   19 |  return curAns;
      |         ^~~~~~
#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...