Submission #396781

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3967812021-04-30 18:10:26ly20Horses (IOI15_horses)C++17
100 / 100
223 ms58752 KiB
#include "horses.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 512345, MOD = 1e9 + 7;
int x[MAXN], y[MAXN];
int seg[4 * MAXN];
long long multe[4 * MAXN], multd[4 * MAXN], ide[4 * MAXN], idd[4 * MAXN];
int n;
int acha() {
//printf("%d\n", seg[1]);
return ((long long) y[seg[1]] * multe[1]) % MOD;
}
int mult (int a, int b) {
long long c = ((long long) a * (long long) b);
if(c >= (long long) MOD) return MOD;
else return (int) c;
}
void build(int cur ,int ini, int fim) {
if(ini == fim) {
seg[cur] = ini;
multe[cur] = x[ini];
multd[cur] = 1;
return;
}
int m = (ini + fim) /2;
int e = 2 * cur, d = 2 * cur + 1;
build(e, ini, m); build(d, m + 1, fim);
int ye = y[seg[e]], yd = y[seg[d]];
if(ide[d] == 1) {
seg[cur] = seg[d];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

horses.cpp: In function 'int acha()':
horses.cpp:11:47: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   11 |     return ((long long) y[seg[1]] * multe[1]) % MOD;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
horses.cpp: In function 'void build(int, int, int)':
horses.cpp:37:31: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   37 |     int md = mult(mult(multe[d], multd[e]), y[seg[d]]);
      |                        ~~~~~~~^
horses.cpp:37:41: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   37 |     int md = mult(mult(multe[d], multd[e]), y[seg[d]]);
      |                                  ~~~~~~~^
horses.cpp:42:39: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |         if(mult(multe[e], mult(multd[e], multe[d])) == MOD) ide[cur] = 1;
      |                                ~~~~~~~^
horses.cpp:42:49: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |         if(mult(multe[e], mult(multd[e], multe[d])) == MOD) ide[cur] = 1;
      |                                          ~~~~~~~^
horses.cpp:42:24: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   42 |         if(mult(multe[e], mult(multd[e], multe[d])) == MOD) ide[cur] = 1;
      |                 ~~~~~~~^
horses.cpp:49:34: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   49 |         int teste = (mult(multd[d], multe[d]), multd[e]);
      |                           ~~~~~~~^
horses.cpp:49:44: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   49 |         int teste = (mult(multd[d], multe[d]), multd[e]);
      |                                     ~~~~~~~^
horses.cpp:49:46: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   49 |         int teste = (mult(multd[d], multe[d]), multd[e]);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
horses.cpp:28:9: warning: unused variable 'ye' [-Wunused-variable]
   28 |     int ye = y[seg[e]], yd = y[seg[d]];
      |         ^~
horses.cpp:28:25: warning: unused variable 'yd' [-Wunused-variable]
   28 |     int ye = y[seg[e]], yd = y[seg[d]];
      |                         ^~
horses.cpp: In function 'void update(int, int, int, int)':
horses.cpp:78:31: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   78 |     int md = mult(mult(multe[d], multd[e]), y[seg[d]]);
      |                        ~~~~~~~^
horses.cpp:78:41: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   78 |     int md = mult(mult(multe[d], multd[e]), y[seg[d]]);
      |                                  ~~~~~~~^
horses.cpp:83:39: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   83 |         if(mult(multe[e], mult(multd[e], multe[d])) == MOD) ide[cur] = 1;
      |                                ~~~~~~~^
horses.cpp:83:49: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   83 |         if(mult(multe[e], mult(multd[e], multe[d])) == MOD) ide[cur] = 1;
      |                                          ~~~~~~~^
horses.cpp:83:24: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   83 |         if(mult(multe[e], mult(multd[e], multe[d])) == MOD) ide[cur] = 1;
      |                 ~~~~~~~^
horses.cpp:90:34: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   90 |         int teste = (mult(multd[d], multe[d]), multd[e]);
      |                           ~~~~~~~^
horses.cpp:90:44: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   90 |         int teste = (mult(multd[d], multe[d]), multd[e]);
      |                                     ~~~~~~~^
horses.cpp:90:46: warning: conversion from 'long long int' to 'int' may change value [-Wconversion]
   90 |         int teste = (mult(multd[d], multe[d]), multd[e]);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
#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...