Submission #126543

#TimeUsernameProblemLanguageResultExecution timeMemory
126543Eug1enaHorses (IOI15_horses)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> #include <vector> #include <cmath> using namespace std; using lint = long long; const lint mod = 1e9 + 7; lint power(lint base, lint exponent){ if(exponent & 1){ return power(base, exponent - 1) * base % mod; }else if(exponent){ lint root = power(base, exponent / 2); return root * root % mod; }else{ return 1; } } struct segtree{ int sz = 1; vector<pair<double, lint>> data; vector<pair<lint, lint>> lazy; segtree(int n){ while(n > sz){ sz *= 2; } data.resize(sz * 2 - 1, {0.0, 1}); lazy.resize(sz * 2 - 1, {0.0, 1}); } pair<double, lint> muldev(pair<double, lint> a, pair<lint, lint> b){ a.first += log(b.first) - log(b.second); a.second = (a.second * b.first) % mod * power(b.second, mod - 2) % mod; } void eval(int l, int r, int now){ data[now] = muldev(data[now], lazy[now]); if(r - l > 1){ lazy[now * 2 + 1].first = (lazy[now * 2 + 1].first * lazy[now].first) % mod; lazy[now * 2 + 1].second = (lazy[now * 2 + 1].second * lazy[now].second) % mod; lazy[now * 2 + 2].first = (lazy[now * 2 + 2].first * lazy[now].first) % mod; lazy[now * 2 + 2].second = (lazy[now * 2 + 2].second * lazy[now].second) % mod; } lazy[now] = {1, 1}; } pair<double, lint> maximum(int a, int b, int l, int r, int now){ eval(l, r, now); if(a <= l && r <= b){ return data[now]; }else if(r <= a || b <= l){ return {0.0, 1}; }else{ return max(maximum(a, b, l, (l + r) / 2, now * 2 + 1), maximum(a, b, (l + r) / 2, r, now * 2 + 2)); } } void change(int a, in) }; int main(){ }

Compilation message (stderr)

horses.cpp:60:24: error: 'in' has not been declared
     void change(int a, in)
                        ^~
horses.cpp:60:26: error: expected ';' at end of member declaration
     void change(int a, in)
                          ^
horses.cpp: In member function 'std::pair<double, long long int> segtree::muldev(std::pair<double, long long int>, std::pair<long long int, long long int>)':
horses.cpp:36:5: warning: no return statement in function returning non-void [-Wreturn-type]
     }
     ^