This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl
lli x[1002],y[1002],n,MAX,a;
int init(int N, int X[], int Y[]) {
n = N;
MAX = 0;
rep (i,0,n-1) {
if (i > 0) x[i] = X[i] * x[i-1];
else x[i] = X[i];
y[i] = Y[i];
a = x[i] * y[i];
if (a > MAX) MAX = a;
}
return MAX;
}
int updateX(int pos, int val) {
lli pas = x[pos];
MAX = 0;
rep(i,0,n-1) {
if (i >= pos){
x[i] /= pas;
x[i] *= val;
}
a = x[i]*y[i];
if (a > MAX) MAX = a;
}
return MAX;
}
int updateY(int pos, int val) {
MAX = 0;
rep(i,0,n-1) {
if (i == pos) y[i] = val;
a = x[i]*y[i];
if (a > MAX) MAX = a;
}
return MAX;
}
Compilation message (stderr)
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:27:12: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
27 | return MAX;
| ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:44:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
44 | return MAX;
| ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:57:9: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
57 | return MAX;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |