Submission #1243205

#TimeUsernameProblemLanguageResultExecution timeMemory
1243205BlockOGHorses (IOI15_horses)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> // mrrrow meeow :3 // go play vivid/stasis now! it's free on steam #define fo(i, a, b) for (auto i = (a); i < (b); i++) #define of(i, a, b) for (auto i = (b); i-- > (a);) #define f first #define s second #define pb push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define be(a) a.begin(), a.end() using namespace std; int ____init = [] { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); return 0; }(); struct BigInt { int v; bool too_big; BigInt(int v) : v(v % 1000000007), too_big(v > 1000000000) {} BigInt operator*(BigInt const &other) { BigInt res((long long)v * other.v % 1000000007); res.too_big = too_big ? true : v == 0 ? false : other.too_big ? true : other.v == 0 ? false : (long long)v * other.v > 1000000000; return res; } bool operator>(BigInt const &other) { return too_big == other.too_big ? v > other.v : too_big > other.too_big; } }; struct SegTree { BigInt xl, xr, y; SegTree() : xl(1), xr(1), y(0) {} SegTree combine(SegTree &r) { SegTree &l = *this; SegTree res; if (l.y > l.xr * r.xl * r.y) { res.xl = l.xl; res.xr = l.xr * r.xl * r.xr; res.y = l.y; } else { res.xl = l.xl * l.xr * r.xl; res.xr = r.xr; res.y = r.y; } return res; } }; const int N = 1 << 19; SegTree st[N * 2]; int init(int n, int x[], int y[]) { fo(i, 0, n) st[N + i].xl = BigInt(x[i]), st[N + i].y = BigInt(y[i]); of(i, 1, N) st[i] = st[i * 2].combine(st[i * 2 + 1]); return (st[1].xl * st[1].y).v; } int updateX(int pos, int val) { st[N + pos].xl = BigInt(val); for (int i = (N + pos) / 2; i > 0; i /= 2) st[i] = st[i * 2].combine(st[i * 2 + 1]); return (st[1].xl * st[1].y).v; } int updateY(int pos, int val) { st[N + pos].y = BigInt(val); for (int i = (N + pos) / 2; i > 0; i /= 2) st[i] = st[i * 2].combine(st[i * 2 + 1]); return (st[1].xl * st[1].y).v; } #ifndef ONLINE_JUDGE int main() { int n; cin >> n; int x[n]; fo(i, 0, n) cin >> x[i]; int y[n]; fo(i, 0, n) cin >> y[i]; cout << init(n, x, y) << endl; int m; cin >> m; fo(it, 0, m) { int type, pos, val; cin >> type >> pos >> val; cout << (type == 1 ? updateX : updateY)(pos, val) << endl; } } #endif

Compilation message (stderr)

/usr/bin/ld: /tmp/cc5Del20.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccDvzNzB.o:horses.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status