Submission #420114

#TimeUsernameProblemLanguageResultExecution timeMemory
420114Aldas25Horses (IOI15_horses)C++14
17 / 100
1582 ms14096 KiB
#include "horses.h"
#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;

const int MAXN = 500100;
const ll MOD = 1e9+7;

int n;
ll x[MAXN], y[MAXN];

ll getMax () {
    ll ret = 0;
    ll cur = 1;
    FOR(i, 0, n-1) {
        cur *= x[i];
        ret = max(ret, cur * y[i]);
    }
    return ret;
}

int init(int N, int X[], int Y[]) {
    n = N;
    FOR(i, 0, n-1) x[i] = X[i];
    FOR(i, 0, n-1) y[i] = Y[i];

	return getMax();
}

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

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

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:39:15: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   39 |  return getMax();
      |         ~~~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:44:15: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   44 |  return getMax();
      |         ~~~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:49:15: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
   49 |  return getMax();
      |         ~~~~~~^~
#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...