Submission #259347

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2593472020-08-07 16:17:56IOrtroiiiHorses (IOI15_horses)C++14
100 / 100
344 ms75000 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const int MX = 1 << 19;
int N;
int X[MX], Y[MX];
pair<ld, int> best[MX << 2];
ld sum[MX << 2];
void pop(int v) {
best[v] = max(best[v << 1], make_pair(best[v << 1 | 1].first + sum[v << 1], best[v << 1 | 1].second));
sum[v] = sum[v << 1] + sum[v << 1 | 1];
}
void init(int v, int l, int r) {
if (l == r) {
best[v] = make_pair(log(X[l]) + log(Y[l]), l);
sum[v] = log(X[l]);
return;
}
int md = (l + r) >> 1;
init(v << 1, l, md);
init(v << 1 | 1, md + 1, r);
pop(v);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

horses.cpp: In function 'int mult(int, int)':
horses.cpp:47:43: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
 int mult(int x, int y) { return ll(x) * y % MOD; }
                                 ~~~~~~~~~~^~~~~
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:78:36: warning: declaration of '_N' shadows a global declaration [-Wshadow]
 int init(int _N, int _X[], int _Y[]) {
                                    ^
horses.cpp:50:5: note: shadowed declaration is here
 int _N;
     ^~
#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...