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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
#define ffor(i, a, b) for (ll i = (a); i < (ll)(b); i++)
#define fford(i, a, b) for (ll i = (a); i > (ll)(b); i--)
#define rep(i, n) ffor(i, 0, n)
#define forin(x, a) for (auto &x: a)
#define all(a) a.begin(), a.end()
int n;
vii x, y;
ll mod = 1000000007;
int init(int N, int X[], int Y[]) {
n = N;
rep(i, n) {
x.emplace_back(X[i]);
y.emplace_back(Y[i]);
}
ll res = (x[0] * y[0]) % mod;
ll curr = x[0], delta = 1;
int p = 0;
ffor(i, 1, n) {
delta *= x[i];
if (y[i] * delta >= y[p] || y[i] * delta < 0) {
delta %= mod;
curr *= delta;
curr %= mod;
res = curr * y[i];
res %= mod;
delta = 1;
p = i;
}
}
return res;
}
int updateX(int pos, int val) {
x[pos] = val;
ll res = (x[0] * y[0]) % mod;
ll curr = x[0], delta = 1;
int p = 0;
ffor(i, 1, n) {
delta *= x[i];
if (y[i] * delta >= y[p] || y[i] * delta < 0) {
delta %= mod;
curr *= delta;
curr %= mod;
res = curr * y[i];
res %= mod;
delta = 1;
p = i;
}
}
return res;
}
int updateY(int pos, int val) {
y[pos] = val;
ll res = (x[0] * y[0]) % mod;
ll curr = x[0], delta = 1;
int p = 0;
ffor(i, 1, n) {
delta *= x[i];
if (y[i] * delta >= y[p] || y[i] * delta < 0) {
delta %= mod;
curr *= delta;
curr %= mod;
res = curr * y[i];
res %= mod;
delta = 1;
p = i;
}
}
return res;
}
Compilation message (stderr)
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:46:8: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
46 | p = i;
| ^
horses.cpp:49:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
49 | return res;
| ^~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:66:8: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
66 | p = i;
| ^
horses.cpp:69:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
69 | return res;
| ^~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:86:8: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
86 | p = i;
| ^
horses.cpp:89:9: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
89 | return res;
| ^~~
# | 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... |