Submission #298161

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2981612020-09-12 12:58:33TMJNHorses (IOI15_horses)C++17
34 / 100
1596 ms70724 KiB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
constexpr long long mod=1000000007;
pair<long double,long long> treemax[1<<20],treeupd[1<<20];
int N,*X,*Y;
long long pw(long long x,int y){
long long a=1;
while(y){
if(y&1)a=a*x%mod;
x=x*x%mod;
y/=2;
}
return a;
}
long long modinv(long long x){
return pw(x,mod-2);
}
void update(int k,int l,int r,int p,int q,long long val,double ln){
if(q<l||r<p)return;
else if(p<=l&&r<=q){
treemax[k].second*=val;
treemax[k].second%=mod;
treemax[k].first+=ln;
treeupd[k].second*=val;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:68:20: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   68 |  return treemax[1].second;
      |         ~~~~~~~~~~~^~~~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:72:75: warning: conversion from 'long double' to 'double' may change value [-Wfloat-conversion]
   72 |  update(1,0,(1<<19)-1,pos,N-1,val*modinv(X[pos])%mod,log((long double)val)-log((long double)X[pos]));
      |                                                      ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
horses.cpp:74:20: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   74 |  return treemax[1].second;
      |         ~~~~~~~~~~~^~~~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:78:75: warning: conversion from 'long double' to 'double' may change value [-Wfloat-conversion]
   78 |  update(1,0,(1<<19)-1,pos,pos,val*modinv(Y[pos])%mod,log((long double)val)-log((long double)Y[pos]));
      |                                                      ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
horses.cpp:80:20: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   80 |  return treemax[1].second;
      |         ~~~~~~~~~~~^~~~~~
#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...