Submission #513845

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5138452022-01-17 17:33:40sliviuHorses (IOI15_horses)C++14
17 / 100
134 ms59196 KiB
#include <bits/stdc++.h>
#include "horses.h"
using namespace std;
const int mod = 1e9 + 7;
int n, curx = 1, x[1 << 19], y[1 << 19], curinv;
long double rcurx = 0, rcurinv;
struct node {
int val = 1, lazy = 1;
long double rval, rlazy;
} st[1 << 20];
void Build(int node = 1, int left = 1, int right = n) {
if (left == right) {
curx = 1LL * curx * x[left - 1] % mod;
st[node].val = 1LL * curx * y[left - 1] % mod;
rcurx += log10(x[left - 1]);
st[node].rval = rcurx + log10(y[left - 1]);
return;
}
int m = (left + right) / 2;
Build(2 * node, left, m), Build(2 * node + 1, m + 1, right);
if (st[2 * node].rval > st[2 * node + 1].rval)
st[node].rval = st[2 * node].rval, st[node].val = st[2 * node].val;
else
st[node].rval = st[2 * node + 1].rval, st[node].val = st[2 * node + 1].val;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

horses.cpp: In function 'void Build(int, int, int)':
horses.cpp:17:35: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   17 |   curx = 1LL * curx * x[left - 1] % mod;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:18:43: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   18 |   st[node].val = 1LL * curx * y[left - 1] % mod;
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'void Propagate(int, int, int)':
horses.cpp:35:52: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   35 |  st[node].val = 1LL * st[node].val * st[node].lazy % mod;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:38:63: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   38 |   st[2 * node].lazy = 1LL * st[2 * node].lazy * st[node].lazy % mod, st[2 * node].rlazy += st[node].rlazy;
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp:39:71: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   39 |   st[2 * node + 1].lazy = 1LL * st[2 * node + 1].lazy * st[node].lazy % mod, st[2 * node + 1].rlazy += st[node].rlazy;
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'void Update(int, long double, int, int, int, int, int)':
horses.cpp:46:45: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   46 |   st[node].lazy = 1LL * st[node].lazy * val % mod;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int pow(int, int)':
horses.cpp:67:24: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   67 |    ans = 1LL * ans * b % mod;
      |          ~~~~~~~~~~~~~~^~~~~
horses.cpp:68:19: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   68 |   b = 1LL * b * b % mod, e >>= 1;
      |       ~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:84:42: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   84 |  Update(1LL * val * pow(x[pos], mod - 2) % mod, -log(x[pos]) + log(val), pos + 1);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:90:42: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   90 |  Update(1LL * val * pow(y[pos], mod - 2) % mod, -log(y[pos] + log(val)), pos + 1, pos + 1);
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
#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...