MSBOP 2015 Round3 register

Ended

Participants:978

Verdict:AC | AC
Submitted:2015-05-09 15:14:32

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 <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
#define MAXN 210000
#define MAXQ 210000
#define MAXLOGN 19
int T;
int A[MAXLOGN][MAXN];
int N,Q;
int bsearch(int *A, int n, int k)
{
    int l = 0, r = n-1, m;
    while (r - l > 1)
    {
        m = (l+r) >>1;
        if (A[m] <= k)
        {
            l = m;
        }
        else
        {
            r = m;
        }
    }
    return min(abs(A[l] - k), abs(A[r] - k));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX