제출 #139887

#제출 시각아이디문제언어결과실행 시간메모리
139887Plurm말 (IOI15_horses)C++11
컴파일 에러
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[idx]); seg2[c] = log2l(rx[idx]) + log2l(ry[idx]); seg3[c] = rx[l]; seg4[c] = (1ll * rx[l] * ry[l]) % MOD; 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]; }

컴파일 시 표준 에러 (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:43:22: error: 'l' was not declared in this scope
         seg3[c] = rx[l];
                      ^
horses.cpp:51: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:57: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;
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~