이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define L(x) ((x)<<1)
#define R(x) (((x)<<1)|1)
struct Node{
double sumx, y, max_val;
int res, modx, xx, yy;
} tree[1<<21];
int n;
void update(int l, int r, int x, int pos, int dx, int dy){
if( r < pos || pos < l) return;
if( l == pos && l == r ){
if( dx ) tree[x].sumx = log10(dx), tree[x].xx = dx;
if( dy ) tree[x].y = log10(dy), tree[x].yy = dy;
tree[x].max_val = tree[x].sumx + tree[x].y;
tree[x].res = 1LL * tree[x].xx * tree[x].yy % mod;
tree[x].modx = tree[x].xx;
return;
}
int mid = (l+r)>>1;
update( l, mid, L(x), pos, dx, dy );
update( mid+1, r, R(x), pos, dx, dy );
tree[x].sumx = tree[L(x)].sumx + tree[R(x)].sumx;
tree[x].modx = 1LL * tree[L(x)].modx * tree[R(x)].modx % mod;
if( tree[L(x)].max_val < tree[R(x)].max_val + tree[L(x)].sumx ){
tree[x].max_val = tree[R(x)].max_val + tree[L(x)].sumx;
tree[x].res = 1LL * tree[R(x)].res * tree[L(x)].modx % mod;
}
else{
tree[x].max_val = tree[L(x)].max_val;
tree[x].res = tree[L(x)].res;
}
}
int init(int N, int X[], int Y[]) {
n = N;
for(int i = 0 ; i < n ; i++) update( 0, n-1, 1, i, X[i], Y[i] );
return tree[1].res;
}
int updateX(int pos, int val) {
update(0, n-1, 1, pos, val, 0);
return tree[1].res;
}
int updateY(int pos, int val) {
update(0, n-1, 1, pos, 0, val);
return tree[1].res;
}
컴파일 시 표준 에러 (stderr) 메시지
horses.cpp: In function 'void update(int, int, int, int, int, int)':
horses.cpp:21:47: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
tree[x].res = 1LL * tree[x].xx * tree[x].yy % mod;
^
horses.cpp:31:57: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
tree[x].modx = 1LL * tree[L(x)].modx * tree[R(x)].modx % mod;
^
horses.cpp:34:56: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
tree[x].res = 1LL * tree[R(x)].res * tree[L(x)].modx % mod;
^
# | 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... |