이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back
#define lso(x) x&(-x)
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
vi X, Y, T;
int n, N;
int init(int a, int x[], int y[]) {
n = N = a;
X.resize(N); Y.resize(N); T.resize(N);
rep(i,0,N) X[i] = x[i];
rep(i,0,N) Y[i] = y[i];
int look_at = N - 1;
ll pr = X[look_at];
while (pr < 1e9) {
look_at--;
pr*=X[look_at];
}
vector<ll> T(n - look_at);
T[0] = X[n - look_at];
rep(i,1,n-look_at) T[i] = T[i - 1] * X[n - look_at + i];
ll initial = 1;
rep(i,0,look_at) initial = (initial * X[i]) % 1000000009;
ll maxi = 0;
rep(i,0,n-look_at) maxi = max(maxi, Y[n - look_at + i] * T[i]);
return (maxi * initial) % 1000000009;
}
int updateX(int pos, int val) {
X[pos] = val;
int look_at = N - 1;
ll pr = X[look_at];
while (pr < 1e9) {
look_at--;
pr*=X[look_at];
}
vector<ll> T(n - look_at);
T[0] = X[n - look_at];
rep(i,1,n-look_at) T[i] = T[i - 1] * X[n - look_at + i];
ll initial = 1;
rep(i,0,look_at) initial = (initial * X[i]) % 1000000009;
ll maxi = 0;
rep(i,0,n-look_at) maxi = max(maxi, Y[n - look_at + i] * T[i]);
return (maxi * initial) % 1000000009;
}
int updateY(int pos, int val) {
Y[pos] = val;
int look_at = N - 1;
ll pr = X[look_at];
while (pr < 1e9) {
look_at--;
pr*=X[look_at];
}
vector<ll> T(n - look_at);
T[0] = X[n - look_at];
rep(i,1,n-look_at) T[i] = T[i - 1] * X[n - look_at + i];
ll initial = 1;
rep(i,0,look_at) initial = (initial * X[i]) % 1000000009;
ll maxi = 0;
rep(i,0,n-look_at) maxi = max(maxi, Y[n - look_at + i] * T[i]);
return (maxi * initial) % 1000000009;
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:24:10: warning: conversion from 'll' {aka 'long long int'} to 'double' may change value [-Wconversion]
24 | while (pr < 1e9) {
| ^~
horses.cpp:29:14: warning: declaration of 'T' shadows a global declaration [-Wshadow]
29 | vector<ll> T(n - look_at);
| ^
horses.cpp:13:10: note: shadowed declaration is here
13 | vi X, Y, T;
| ^
horses.cpp:37:27: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
37 | return (maxi * initial) % 1000000009;
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:45:10: warning: conversion from 'll' {aka 'long long int'} to 'double' may change value [-Wconversion]
45 | while (pr < 1e9) {
| ^~
horses.cpp:50:14: warning: declaration of 'T' shadows a global declaration [-Wshadow]
50 | vector<ll> T(n - look_at);
| ^
horses.cpp:13:10: note: shadowed declaration is here
13 | vi X, Y, T;
| ^
horses.cpp:58:27: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
58 | return (maxi * initial) % 1000000009;
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:66:10: warning: conversion from 'll' {aka 'long long int'} to 'double' may change value [-Wconversion]
66 | while (pr < 1e9) {
| ^~
horses.cpp:71:14: warning: declaration of 'T' shadows a global declaration [-Wshadow]
71 | vector<ll> T(n - look_at);
| ^
horses.cpp:13:10: note: shadowed declaration is here
13 | vi X, Y, T;
| ^
horses.cpp:79:27: warning: conversion from 'll' {aka 'long long int'} to 'int' may change value [-Wconversion]
79 | return (maxi * initial) % 1000000009;
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
# | 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... |