Submission #594448

#TimeUsernameProblemLanguageResultExecution timeMemory
594448davi_bartHorses (IOI15_horses)C++14
17 / 100
1572 ms14436 KiB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>

#include "horses.h"
using namespace std;
#define ll long long
#define int ll
#define fi first
#define se second
#define ld long double
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
static const int mod = 1e9 + 7;
vector<int> X, Y;
int N;
int calc() {
    int ma = 0;
    int cur = 1;
    for (int i = 0; i < N; i++) {
        cur *= X[i];
        ma = max(ma, cur * Y[i] % mod);
    }
    return ma;
}
signed init(signed N, signed x[], signed y[]) {
    ::N = N;
    for (int i = 0; i < N; i++) {
        X.pb(x[i]);
        Y.pb(y[i]);
    }
    return calc();
}

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

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

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:25:20: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   25 | signed init(signed N, signed x[], signed y[]) {
      |             ~~~~~~~^
horses.cpp:15:5: note: shadowed declaration is here
   15 | int N;
      |     ^
horses.cpp:31:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   31 |     return calc();
      |            ~~~~^~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:36:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   36 |     return calc();
      |            ~~~~^~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:41:16: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   41 |     return calc();
      |            ~~~~^~
#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...