Submission #795284

#TimeUsernameProblemLanguageResultExecution timeMemory
795284JosiaHorses (IOI15_horses)C++17
17 / 100
1556 ms12040 KiB
#include "horses.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define int long long

const ll mod = 1e9+7;

int N;
vector<ll> X, Y;

struct getSol {
	int sol = 0;

	getSol() {
        int currProd = 1;
		for (int i = 0; i<N; i++) {
            currProd *= X[i];
            if (currProd * Y[i] > sol) sol = currProd*Y[i];
        }
	}
};




signed init(signed _N, signed _X[], signed _Y[]) {
	N = _N;
	X.resize(N);
	Y.resize(N);
	for (int i = 0; i<N; i++) X[i] = _X[i];
	for (int i = 0; i<N; i++) Y[i] = _Y[i];

	return getSol().sol;
}

signed updateX(signed pos, signed val) {
	X[pos] = val;

	return getSol().sol;
}

signed updateY(signed pos, signed val) {
	Y[pos] = val;

	return getSol().sol;
}

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:36:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   36 |  return getSol().sol;
      |         ~~~~~~~~~^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:42:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |  return getSol().sol;
      |         ~~~~~~~~~^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:48:18: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   48 |  return getSol().sol;
      |         ~~~~~~~~~^~~
#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...