Submission #1028535

#TimeUsernameProblemLanguageResultExecution timeMemory
1028535May27_thBubble Sort 2 (JOI18_bubblesort2)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #define i64 long long #define i128 __int128 #define mp make_pair #define pb push_back #define all(x) (x).begin(), (x).end() i64 a[300005]; struct Tree { const i64 INF = 1e18; struct Data { i64 lf, rg, ans; }; vector<Data> st; Tree (int _N) : st(4 * _N + 4) {} Data combine(Data lf, Data rg) { Data res; res.lf = lf.lf; res.rg = rg.rg; res.ans = lf.ans + rg.ans + (lf.rg > rg.lf); return res; } void build(int id, int l, int r) { if (l == r) { st[id].lf = st[id].rg = a[l]; st[id].ans = 0; return; } int mid = (l + r)/2; build(id * 2, l, mid); build(id * 2 + 1, mid + 1, r); st[id] = combine(st[id * 2], st[id * 2 + 1]); } void update(int id, int l, int r, int p, i64 x) { if (p < l || p > r) return; if (l == r) { st[id].lf = st[id].rg = x; st[id].ans = 0; return; } int mid = (l + r)/2; update(id * 2, l, mid, p, x); update(id * 2 + 1, mid + 1, r, p, x); st[id] = combine(st[id * 2], st[id * 2 + 1]); } Data get(int id, int l, int r, int u, int v) { if (v < l || u > r) return {-INF, INF, 0}; if (u <= l && r <= v) return st[id]; int mid = (l + r)/2; return combine(get(id * 2, l, mid, u, v), get(id * 2 + 1, mid + 1, r, u, v)); } }; void countScans(vector<int> a, vector<int> x, vector<int> v) { } void Solve(void) { int N, Q; cin >> N >> Q; Tree T(N + 2); for (int i = 1; i <= N; i ++) cin >> a[i]; T.build(1, 1, N); // cout << T.st[1].ans << "\n"; while (Q --) { int x, v; cin >> x >> v; a[++ x] = v; T.update(1, 1, N, x, a[x]); // cout << x << " " << a[x] << "\n"; cout << T.st[1].ans << "\n"; } } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(10); int Tests = 1; // cin >> Tests; while (Tests --) { Solve(); } }

Compilation message (stderr)

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