이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int c=524288;
long long n, mod=1e9+7;
struct s{
long long r, x, y;
double R, X, Y;
} t[2*c];
void upd(int a) {
int x=2*a, y=x+1;
t[a].X=t[x].X+t[y].X, t[a].x=t[x].x+t[y].x%mod;
if (t[x].R>t[x].X+t[y].R) {
t[a].R=t[x].R, t[a].r=t[x].r;
} else {
t[a].R=t[x].X+t[y].R;
t[a].r=t[x].x*t[y].r%mod;
}
if (a>1) upd(a/2);
}
void add(int a, int x, int y) {
if (x) t[a].x=x, t[a].X=log(x);
if (y) t[a].y=y, t[a].Y=log(y);
t[a].r=t[a].x*t[a].y%mod, t[a].R=t[a].X+t[a].Y;
upd(a/2);
}
int init(int a, int x[], int y[]) {
n=a;
for (int i=0; i<n; i++) add(c+i, x[i], y[i]);
return t[1].r;
}
int updateX(int a, int b) {
add(c+a, b, 0);
return t[1].r;
}
int updateY(int a, int b) {
add(c+a, 0, b);
return t[1].r;
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:29:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
29 | return t[1].r;
| ~~~~~^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:33:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
33 | return t[1].r;
| ~~~~~^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:37:17: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
37 | return t[1].r;
| ~~~~~^
# | 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... |