hiho week 28 register

Ended

Participants:703

Verdict:Accepted
Score:100 / 100
Submitted:2015-01-14 21:14:33

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#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;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX