Submission #139882

#TimeUsernameProblemLanguageResultExecution timeMemory
139882PlurmHorses (IOI15_horses)C++11
Compilation error
0 ms0 KiB
#include "horses.h" #include <bits/stdc++.h> using namespace std; const int MOD = 1e9+7; long double seg1[1048576]; // Sum of log2s long double seg2[1048576]; // log2(Answer) int seg3[1048576]; // Range product query int seg4[1048576]; // Real Answer int lb[1048576]; int rb[1048576]; int rx[500005]; int ry[500005]; void build(int c, int l, int r){ lb[c] = l; rb[c] = r; if(l == r){ seg1[c] = log2l(rx[l]); seg2[c] = log2l(rx[l]) + log2l(ry[l]); seg3[c] = rx[l]; seg4[c] = (1ll * rx[l] * ry[l]) % MOD; return; } int k = (l + r)/2; build(2*c,l,k); build(2*c+1,k+1,r); seg1[c] = seg1[2*c] + seg1[2*c+1]; seg3[c] = (1ll * seg3[2*c] * seg3[2*c+1]) % MOD; if(seg2[2*c] > seg2[2*c+1] + seg1[2*c]){ seg2[c] = seg2[2*c]; seg4[c] = seg4[2*c]; }else{ seg2[c] = seg2[2*c+1] + seg1[2*c]; seg4[c] = (1ll * seg4[2*c+1] * seg3[2*c]) % MOD; } } void update(int c, int idx){ if(lb[c] == rb[c]){ seg1[c] = log2l(rx[l]); seg2[c] = log2l(rx[l]) + log2l(ry[l]); return; } int k = (lb[c] + rb[c])/2; if(idx <= k) update(2*c, idx); else update(2*c+1, idx); seg1[c] = seg1[2*c] + seg1[2*c+1]; seg3[c] = (1ll * seg3[2*c] * seg3[2*c+1]) % MOD; if(seg2[2*c] > seg2[2*c+1] + seg1[2*c]){ seg2[c] = seg2[2*c]; seg4[c] = seg4[2*c]; }else{ seg2[c] = seg2[2*c+1] + seg1[2*c]; seg4[c] = (1ll * seg4[2*c+1] * seg3[2*c]) % MOD; } } int init(int N, int X[], int Y[]) { for(int i = 0; i < N; i++){ rx[i] = X[i]; ry[i] = Y[i]; } build(1,0,N-1); return seg4[1]; } int updateX(int pos, int val) { rx[pos] = val; update(1, pos); return seg4[1]; } int updateY(int pos, int val) { ry[pos] = val; update(1, pos); return seg4[1]; }

Compilation message (stderr)

horses.cpp: In function 'void build(int, int, int)':
horses.cpp:22:41: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         seg4[c] = (1ll * rx[l] * ry[l]) % MOD;
                   ~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:29:47: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     seg3[c] = (1ll * seg3[2*c] * seg3[2*c+1]) % MOD;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:35:51: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         seg4[c] = (1ll * seg4[2*c+1] * seg3[2*c]) % MOD;
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'void update(int, int)':
horses.cpp:41:28: error: 'l' was not declared in this scope
         seg1[c] = log2l(rx[l]);
                            ^
horses.cpp:49:47: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
     seg3[c] = (1ll * seg3[2*c] * seg3[2*c+1]) % MOD;
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:55:51: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
         seg4[c] = (1ll * seg4[2*c+1] * seg3[2*c]) % MOD;
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~