Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include <iostream>#include <fstream>#include <stdlib.h>#include <stdio.h>using namespace std;const int maxn = 100000 + 2;int n, t;int node[maxn << 2], v[maxn << 1];void update(int u) {if (u < 1) return ;int ls = node[u << 1], rs = node[(u << 1) + 1];if (v[ls] > v[rs]) node[u] = node[u << 1];else node[u] = node[(u << 1) + 1];update(u >> 1);}void get(int &n) {n = 0;char ch = getchar();while (ch < '0' || ch > '9') ch = getchar();for ( ; ch >= '0' && ch <= '9'; ch = getchar()) n = n * 10 + ch - '0';}int main() {scanf("%d", &n);t = 1;while (t < n) t <<= 1;for (int i = 0; i < t; i++) node[i + t] = i;