제출 #62309

#제출 시각아이디문제언어결과실행 시간메모리
62309tugushka말 (IOI15_horses)C++14
54 / 100
484 ms34484 KiB
#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{ float 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 = log(dx), tree[x].xx = dx; if( dy ) tree[x].y = log(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:18:30: warning: conversion to 'float' from '__gnu_cxx::__enable_if<true, double>::__type {aka double}' may alter its value [-Wfloat-conversion]
   if( dx ) tree[x].sumx = log(dx), tree[x].xx = dx;
                           ~~~^~~~
horses.cpp:19:27: warning: conversion to 'float' from '__gnu_cxx::__enable_if<true, double>::__type {aka double}' may alter its value [-Wfloat-conversion]
   if( dy ) tree[x].y = log(dy), tree[x].yy = dy;
                        ~~~^~~~
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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...