Submission #40283

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
402832018-01-30 15:38:12szawinisHorses (IOI15_horses)C++14
100 / 100
329 ms41912 KiB
#include "horses.h"
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;
const int N = 1 << 19;
const ll MOD = 1e9 + 7;
ll modPow(ll b, ll e) {
if (!e)
return 1;
if (e == 1)
return b;
return modPow(b * b % MOD, e >> 1) * modPow(b, e & 1) % MOD;
}
struct node {
double comp;
ll val;
void merge(node rhs) {
comp += rhs.comp;
val = 1ll * val * rhs.val % MOD;
}
bool operator>(const node &rhs) const {
return make_pair(comp, val) > make_pair(rhs.comp, rhs.val);
}
} t[2 * N], lz[2 * N];
void build(int i, int l, int r) {
lz[i] = {0, 1};
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

horses.cpp: In function 'void build(int, int, int)':
horses.cpp:33:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int mid = l + r >> 1;
               ^
horses.cpp: In function 'void update(int, int, int, int, int, node)':
horses.cpp:60:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int mid = l + r >> 1;
               ^
horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:81:15: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   return t[1].val;
               ^
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:89:15: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   return t[1].val;
               ^
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:97:15: warning: conversion to 'int' from 'll {aka long long int}' may alter its value [-Wconversion]
   return t[1].val;
               ^
#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...