Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<bits/stdc++.h>using namespace std;typedef long long ll;#ifndef ONLINE_JUDGE#define dbg(x...) do{cout << "\033[33;1m" << #x << "->" ; err(x);} while (0)void err(){cout << "\033[39;0m" << endl;}template<template<typename...> class T, typename t, typename... A>void err(T<t> a, A... x){for (auto v: a) cout << v << ' '; err(x...);}template<typename T, typename... A>void err(T a, A... x){cout << a << ' '; err(x...);}#else#define dbg(...)#endifconst int N = 1e3 + 5;int n;int mxv[N];int lowbit (int x) {return x & (-x);}void update(int x, int v) {while (x <= n) {mxv[x] = max(v, mxv[x]);x += lowbit(x);}}int query(int x) {int ans = 0;