Submission #1033254

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10332542024-07-24 15:17:09socpiteHorses (IOI15_horses)C++17
100 / 100
375 ms53432 KiB
#include "horses.h"
#include<bits/stdc++.h>
using namespace std;
const int maxn = 5e5+5;
const int mod = 1e9+7;
int st_max[4*maxn], st_prod[4*maxn];
int mult[maxn], cost[maxn];
int n;
void build(int X[], int Y[], int l = 0, int r = n-1, int id = 1){
if(l == r){
st_max[id] = Y[l];
st_prod[id] = X[l];
}
else {
int mid = (l+r)>>1;
build(X, Y, l, mid, id<<1);
build(X, Y, mid+1, r, id<<1|1);
st_max[id] = max(st_max[id<<1], st_max[id<<1|1]);
st_prod[id] = 1LL*st_prod[id<<1]*st_prod[id<<1|1]%mod;
}
}
void edit_max(int pos, int val, int l = 0, int r = n-1, int id = 1){
if(l == r)st_max[id] = val;
else {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

horses.cpp: In function 'void build(int*, int*, int, int, int)':
horses.cpp:24:52: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   24 |   st_prod[id] = 1LL*st_prod[id<<1]*st_prod[id<<1|1]%mod;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'void edit_prod(int, int, int, int, int)':
horses.cpp:51:52: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   51 |   st_prod[id] = 1LL*st_prod[id<<1]*st_prod[id<<1|1]%mod;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int get_prod(int, int, int, int, int)':
horses.cpp:59:80: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   59 |  return 1LL*get_prod(ql, qr, l, mid, id<<1)*get_prod(ql, qr, mid+1, r, id<<1|1)%mod;
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int solve()':
horses.cpp:79:36: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   79 |  return 1LL*get_prod(0, best)*bcost%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...