锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产一区二区三区丝袜,91久久精品国产,久久av资源网http://m.shnenglu.com/Ylemzy/category/16412.html瓚寵抗鐨勮凍榪?/description>zh-cnWed, 20 Apr 2011 09:47:52 GMTWed, 20 Apr 2011 09:47:52 GMT601470 Closest Common Ancestors 鈥斺擫cahttp://m.shnenglu.com/Ylemzy/articles/125864.html鐏⒊榛?/dc:creator>鐏⒊榛?/author>Sat, 04 Sep 2010 03:52:00 GMThttp://m.shnenglu.com/Ylemzy/articles/125864.htmlhttp://m.shnenglu.com/Ylemzy/comments/125864.htmlhttp://m.shnenglu.com/Ylemzy/articles/125864.html#Feedback0http://m.shnenglu.com/Ylemzy/comments/commentRss/125864.htmlhttp://m.shnenglu.com/Ylemzy/services/trackbacks/125864.htmlClosest Common Ancestors

Description

Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ancestor of u and v in the tree. The closest common ancestor of two nodes u and v is the node w that is an ancestor of both u and v and has the greatest depth in the tree. A node can be its own ancestor (for example in Figure 1 the ancestors of node 2 are 2 and 5)

Input

The data set, which is read from a the std input, starts with the tree description, in the form:

nr_of_vertices
vertex:(nr_of_successors) successor1 successor2 ... successorn
...
where vertices are represented as integers from 1 to n ( n <= 900 ). The tree description is followed by a list of pairs of vertices, in the form:
nr_of_pairs
(u v) (x y) ...

The input file contents several data sets (at least one).
Note that white-spaces (tabs, spaces and line breaks) can be used freely in the input.

Output

For each common ancestor the program prints the ancestor and the number of pair for which it is an ancestor. The results are printed on the standard output on separate lines, in to the ascending order of the vertices, in the format: ancestor:times
For example, for the following tree:

Sample Input

5
5:(3) 1 4 2
1:(0)
4:(0)
2:(1) 3
3:(0)
6
(1 5) (1 4) (4 2)
(2 3)
(1 3) (4 3)

Sample Output

2:1
5:5
棰樻剰錛氱粰鍑烘爲鐨勭粨鏋勶紝鍐嶇粰鍑鴻璇㈤棶鐨勶紙u錛?v),姹傚嚭璇㈤棶鍚庡叕鍏辮妭鐐瑰嚭鐜扮殑涓暟銆?br>浠g爜錛?br>
#include <stdio.h>
#include 
<stdlib.h>
#include 
<vector>
#define maxn 1000
using namespace std;
int visit[maxn], in[maxn], f[maxn], anc[maxn], num[maxn];
vector
<int> tree[maxn], que[maxn];
void set(int n)
{
    
for (int i = 1; i <= n; i++)
    {
        
in[i] = 0;
        visit[i] 
= 0;
        num[i] 
= 0;
        anc[i] 
= i;
        f[i] 
= -1;
        tree[i].clear();
        que[i].clear();
    }
}
int find(int a)
{
    
if (f[a] < 0)
    {
        
        
return a;
    }
    
return f[a] = find(f[a]);
}
void unions(int a, int b)
{
    a 
= find(a);
    b 
= find(b);
    
if (a != b)
    {
        
if (f[a] > f[b])
        {
            f[b] 
+= f[a];
            f[a] 
= b;
        }
        
else
        {
            f[a] 
+= f[b];
            f[b] 
= a;
        }
    }
}
void lca(int u)
{
    
int i, size;
    size 
= tree[u].size();
    
for (i = 0; i < size; i++)
    {
        lca(tree[u][i]);
        unions(u, tree[u][i]);
        anc[find(u)] 
= u;
    }
    visit[u] 
= 1;
    size 
= que[u].size();
    
for (i = 0; i < size; i++)
    {
        
if (visit[que[u][i]] == 1)
        {
            num[anc[find(que[u][i])]]
++;
        }
    }
}

int main()
{
    
char a[100], b[100];
    
int n, i, j, u, v, m;
    
while (scanf("%d"&n) != EOF)
    {
        
set(n);
        
for (i = 0; i < n; i++)
        {
            scanf(
"%d:(%d)"&u, &m);
            
for (j = 0; j < m; j++)
            {
                scanf(
"%d"&v);
                tree[u].push_back(v);
                
in[v]++;
            }
        }
        scanf(
"%d"&m);
        
while (m--)
        {
            scanf(
" (%d %d)"&u, &v);
            que[u].push_back(v);
            que[v].push_back(u);
        }
        
for (i = 1; i <= n; i++)
        {
            
if (in[i] == 0)
            {
                lca(i);
                
break;
            }
        }
        
for (i = 1; i <= n; i++)
        {
            
if (num[i])
            {
                printf(
"%d:%d\n", i, num[i]);
            }
        }
    }
    system(
"pause");
    
return 0;
}



]]>
pku 1986鈥斺擫CA杞瑀mqhttp://m.shnenglu.com/Ylemzy/articles/123325.html鐏⒊榛?/dc:creator>鐏⒊榛?/author>Fri, 13 Aug 2010 07:08:00 GMThttp://m.shnenglu.com/Ylemzy/articles/123325.htmlhttp://m.shnenglu.com/Ylemzy/comments/123325.htmlhttp://m.shnenglu.com/Ylemzy/articles/123325.html#Feedback0http://m.shnenglu.com/Ylemzy/comments/commentRss/123325.htmlhttp://m.shnenglu.com/Ylemzy/services/trackbacks/123325.htmlDistance Queries

Description

Farmer John's cows refused to run in his marathon since he chose a path much too long for their leisurely lifestyle. He therefore wants to find a path of a more reasonable length. The input to this problem consists of the same input as in "Navigation Nightmare",followed by a line containing a single integer K, followed by K "distance queries". Each distance query is a line of input containing two integers, giving the numbers of two farms between which FJ is interested in computing distance (measured in the length of the roads along the path between the two farms). Please answer FJ's distance queries as quickly as possible!

Input

* Lines 1..1+M: Same format as "Navigation Nightmare"

* Line 2+M: A single integer, K. 1 <= K <= 10,000

* Lines 3+M..2+M+K: Each line corresponds to a distance query and contains the indices of two farms.

Output

* Lines 1..K: For each distance query, output on a single line an integer giving the appropriate distance.

Sample Input

7 6
1 6 13 E
6 3 9 E
3 5 7 S
4 1 3 N
2 4 20 W
4 7 2 S
3
1 6
1 4
2 6

Sample Output

13
3
36
棰樻剰錛氱粰鍑轟竴媯墊爲錛屽叾瀹炴槸涓浘銆傛眰鍑轟袱鐐逛箣闂寸殑鏈鐭窛紱匯?br>
#include <stdio.h>
#include 
<stdlib.h>
#include 
<math.h>
#define maxn 600010
int son[maxn], loc[maxn], dis[maxn], sw[maxn], indegree[maxn], th;
struct T
{
    
int e, d;
}rmq[maxn
*2][30];
struct F
{
    
int u, v, w, next; 
}fn[maxn 
* 2];
void set(int n)
{
    
for (int i = 1; i <= n; i++)
    {
        son[i] 
= 0;
        indegree[i] 
= 0;
        dis[i] 
= -1;
        loc[i] 
= -1;
    }
    
for (int i = 1; i <= n; i++)
    {
        fn[i].next 
= 0;
    }
}
void link(int u, int v, int w)
{
    
/*
    鏍戠殑閬嶅巻錛岃繖涓緱璁頒綇銆傝妭鐪佺┖闂淬?br>    
*/
    th
++;
    fn[th].u 
= u, fn[th].v = v, fn[th].w = w, fn[th].next = son[u], son[u] = th;
    th
++;
    fn[th].u 
= v, fn[th].v = u, fn[th].w = w, fn[th].next = son[v], son[v] = th;
}
/*
閫氳繃鎼滅儲鏉ョ敓鎴愭爲鐨勯亶鍘嗚妭鐐?br>
*/
void dfs(int d, int u, int f, int sd)
{
    
int v, i;
    th
++;
    
if (loc[u] == -1)//鍙繕娌″嚭鐜拌繃鐨勮妭鐐瑰湪閬嶅巻涓殑鏃墮棿鎴籌紙浣嶇疆錛?/span>
    {
        loc[u] 
= th;
        dis[u] 
= sd;//璺濈鏄彔鍔犵殑銆?/span>
    }
    rmq[th][
0].e = u;
    rmq[th][
0].d = d;
    
for (i = son[u]; i; i = fn[i].next)
    {
        
if (fn[i].v != f)
        {
            dfs(d 
+ 1, fn[i].v, u, sd + fn[i].w);
            th
++;
            rmq[th][
0].e = u;
            rmq[th][
0].d = d;
        }
    }
}
void build (int n)
{
    
int c = log((double)n) / log(2.0), i, j, m;
    
for (i = 1; i <= c; i++)
    {
        
for (j = 1; j <= n; j++)
        {
            m 
= j + (1 << (i - 1));
            
if (m > n)
            {
                rmq[j][i] 
= rmq[j][i-1];
            }
            
else
            {
                
if (rmq[j][i-1].d <= rmq[m][i-1].d)
                {
                    rmq[j][i] 
= rmq[j][i-1];
                }
                
else
                {
                    rmq[j][i] 
= rmq[m][i-1];
                }
            }
        }
    }
}
int query(int u, int v)
{
    
if (loc[u] > loc[v])
    {
        u 
^= v;
        v 
^= u;
        u 
^= v;
    }
    
int i = loc[u], j = loc[v];
    
int len = j - i + 1;
    
int c = log((double)len) / log(2.0);
    
int m = j - (1 << c) + 1;
    
int ancestor;
    
if (rmq[i][c].d <= rmq[m][c].d)
    {
        ancestor 
= rmq[i][c].e;
    }
    
else
    {
        ancestor 
= rmq[m][c].e;
    }
    
return dis[u] + dis[v] - 2 * dis[ancestor];
}
int main()
{
    
char c[2];
    
int n, m, u, v, w, k, t, i;
    scanf(
"%d%d"&n, &m);
    
set(n);
    th 
= 0;
    
while (m--)
    {
        scanf(
"%d%d%d%s"&u, &v, &w, c);
        link(u, v, w);
    }
    th 
= 0;
    dfs(
0100);
    build (
2 * n - 1);
    scanf(
"%d"&k);
    
while (k--)
    {
        scanf(
"%d%d"&u, &v);
        printf(
"%d\n", query(u, v));
    }
    
return 0;
}



]]>
pku 3368鈥斺擱MQhttp://m.shnenglu.com/Ylemzy/articles/123100.html鐏⒊榛?/dc:creator>鐏⒊榛?/author>Wed, 11 Aug 2010 12:25:00 GMThttp://m.shnenglu.com/Ylemzy/articles/123100.htmlhttp://m.shnenglu.com/Ylemzy/comments/123100.htmlhttp://m.shnenglu.com/Ylemzy/articles/123100.html#Feedback0http://m.shnenglu.com/Ylemzy/comments/commentRss/123100.htmlhttp://m.shnenglu.com/Ylemzy/services/trackbacks/123100.htmlFrequent values

Description

You are given a sequence of n integers a1 , a2 , ... , an in non-decreasing order. In addition to that, you are given several queries consisting of indices i and j (1 ≤ i ≤ j ≤ n). For each query, determine the most frequent value among the integers ai , ... , aj.

Input

The input consists of several test cases. Each test case starts with a line containing two integers n and q (1 ≤ n, q ≤ 100000). The next line contains n integers a1 , ... , an (-100000 ≤ ai ≤ 100000, for each i ∈ {1, ..., n}) separated by spaces. You can assume that for each i ∈ {1, ..., n-1}: ai ≤ ai+1. The following q lines contain one query each, consisting of two integers i and j (1 ≤ i ≤ j ≤ n), which indicate the boundary indices for the
query.

The last test case is followed by a line containing a single 0.

Output

For each query, print one line with one integer: The number of occurrences of the most frequent value within the given range.

Sample Input

10 3
-1 -1 1 1 1 1 3 10 10 10
2 3
1 10
5 10
0

Sample Output

1
4
3
棰樻剰錛氭煡鎵懼尯闂村唴鏁板嚭鐜版渶澶氱殑嬈℃暟
#include <stdio.h>
#include 
<stdlib.h>
#include 
<math.h>
#define maxn 100010
#define Max(a, b) a > b ? a : b
int num[maxn], v[maxn], rq[maxn][20];
void build(int n)
{
    
int i, j, m, r = n, c = log((double)n) / log(2.0);
    
for (i = 1; i <= n; i++)
    {
        rq[i][
0= v[i];
    }
    
for (i = 1; i <= c; i++)
    {
        
for (j = 1; j <= r; j++)
        {
            m 
= j + (1 << (i - 1));a
            
if (m <= r)
            {
                rq[j][i] 
= Max(rq[j][i-1], rq[m][i-1]);
            }
            
else
            {
                rq[j][i] 
= rq[j][i-1];
            }
        }
    }
}
int rmq(int l, int r)
{
    
int len = r - l + 1;
    
int k = log(double(len)) / log(2.0);
    
int m = r - (1 << k) + 1;
    
return Max(rq[l][k], rq[m][k]);
}
int query(int l, int r)
{
    
int left, i;
    
if (num[l] == num[r])
    {
        
return r - l + 1;
    }
    
for (i = l; ; i++)
    {
        
if (v[i] == 1)
        {
            left 
= i - l;
            
break;
        }
    }
    
return Max(left, rmq(i, r));
}
int main()
{
    
int n, m, i, l, r;
    
while (scanf("%d%d"&n, &m) == 2)
    {
        scanf(
"%d"&num[1]);
        v[
1= 1;
        
for (i = 2; i <= n; i++)
        {
            scanf(
"%d"&num[i]);
            
if (num[i] == num[i-1])
            {
                v[i] 
= v[i-1+ 1;
            }
            
else
            {
                v[i] 
= 1;
            }
        }
        build(n);
        
while (m--)
        {
            scanf(
"%d%d"&l, &r);
            printf(
"%d\n", query(l, r));
        }
    }
    
return 0;
}



]]>
pku 1330鈥斺擫CA鐨勭綰跨畻娉晅arjanhttp://m.shnenglu.com/Ylemzy/articles/122088.html鐏⒊榛?/dc:creator>鐏⒊榛?/author>Tue, 03 Aug 2010 09:41:00 GMThttp://m.shnenglu.com/Ylemzy/articles/122088.htmlhttp://m.shnenglu.com/Ylemzy/comments/122088.htmlhttp://m.shnenglu.com/Ylemzy/articles/122088.html#Feedback0http://m.shnenglu.com/Ylemzy/comments/commentRss/122088.htmlhttp://m.shnenglu.com/Ylemzy/services/trackbacks/122088.htmlNearest Common Ancestors

Description

A rooted tree is a well-known data structure in computer science and engineering. An example is shown below:


In the figure, each node is labeled with an integer from {1, 2,...,16}. Node 8 is the root of the tree. Node x is an ancestor of node y if node x is in the path between the root and node y. For example, node 4 is an ancestor of node 16. Node 10 is also an ancestor of node 16. As a matter of fact, nodes 8, 4, 10, and 16 are the ancestors of node 16. Remember that a node is an ancestor of itself. Nodes 8, 4, 6, and 7 are the ancestors of node 7. A node x is called a common ancestor of two different nodes y and z if node x is an ancestor of node y and an ancestor of node z. Thus, nodes 8 and 4 are the common ancestors of nodes 16 and 7. A node x is called the nearest common ancestor of nodes y and z if x is a common ancestor of y and z and nearest to y and z among their common ancestors. Hence, the nearest common ancestor of nodes 16 and 7 is node 4. Node 4 is nearer to nodes 16 and 7 than node 8 is.

For other examples, the nearest common ancestor of nodes 2 and 3 is node 10, the nearest common ancestor of nodes 6 and 13 is node 8, and the nearest common ancestor of nodes 4 and 12 is node 4. In the last example, if y is an ancestor of z, then the nearest common ancestor of y and z is y.

Write a program that finds the nearest common ancestor of two distinct nodes in a tree.

Input

The input consists of T test cases. The number of test cases (T) is given in the first line of the input file. Each test case starts with a line containing an integer N , the number of nodes in a tree, 2<=N<=10,000. The nodes are labeled with integers 1, 2,..., N. Each of the next N -1 lines contains a pair of integers that represent an edge --the first integer is the parent node of the second integer. Note that a tree with N nodes has exactly N - 1 edges. The last line of each test case contains two distinct integers whose nearest common ancestor is to be computed.

Output

Print exactly one line for each test case. The line should contain the integer that is the nearest common ancestor.

Sample Input

2
16
1 14
8 5
10 16
5 9
4 6
8 4
4 10
1 13
6 15
10 11
6 7
10 2
16 3
8 1
16 12
16 7
5
2 3
3 4
3 1
1 5
3 5

Sample Output

4
3
棰樻剰錛氱粰鍑烘爲鐨勭粨鏋勶紝闂袱鑺傜偣鐨勬渶榪戝叕鍏辯埗鑺傜偣銆?br>浠g爜錛?br>
#include <stdio.h>
#include 
<vector>
#define maxn 10001
using namespace std;
int visit[maxn], indegree[maxn], f[maxn], ancestor[maxn];
vector
<int> tree[maxn], que[maxn];
void init(int n)
{
    
int i;
    
for (i = 1; i <= n; i++)
    {
        tree[i].clear();
        que[i].clear();
        f[i] 
= -1;
        visit[i] 
= 0;
        indegree[i] 
= 0;
        ancestor[i] 
= i;
    }
}
int find(int a)
{
    
if (f[a] < 0)
    {
        
return a;
    }
    
return f[a] = find(f[a]);
}
void unions(int a, int b)
{
    a 
= find(a), b = find(b);
    
if (a != b)
    {
        
if (f[a] > f[b])
        {
            f[b] 
+= f[a];
            f[a] 
= b;
        }
        
else
        {
            f[a] 
+= f[b];
            f[b] 
= a;
        }
    }
}
void lca(int u)
{
    
int i, size;
    size 
= tree[u].size();
    
for (i = 0; i < size; i++)
    {
        lca(tree[u][i]);
        unions(u, tree[u][i]);
        ancestor[find(u)] 
= u;
        
/*瀵逛簬澶勭悊榪囩殑瀛╁瓙錛屽叾紲栧厛瑕佹敼涓哄綋鍓嶈妭鐐癸紝淇濊瘉榪欐5鏁扮殑閬嶅巻閫昏緫錛?br>        鍥犱負騫舵煡闆嗙殑鍚堝茍鏄寜鏉冨艱岄潪閬嶅巻欏哄簭鍚堝茍鐨?閫氳繃騫舵煡闆嗛珮鏁堣幏寰楀瓙鏍戦泦鍚堢殑绔彛錛屽湪閫氳繃榪欑鍙h幏寰?br>        璇ュ瓙鏍戝湪榪欎釜鏃墮棿孌電殑鐪熸鏈榪戠埗鑺傜偣錛屽鍥句腑鐨?鍦ㄥ茍鏌ユ爲涓細琚綊騫朵負6鐨勫瀛愶紝鍥犱負鏉冨肩殑闂*/
    }
    visit[u] 
= 1;
    size 
= que[u].size();
    
for (i = 0; i < size; i++)
    {
        
if (visit[que[u][i]] == 1)
        {
            printf(
"%d\n", ancestor[find(que[u][i])]);
            
return;
        }
    }
}
int main()
{
    
int n, t, i, u, v;
    scanf(
"%d"&t);
    
while (t--)
    {
        scanf(
"%d"&n);
        init(n);
        
for (i = 1; i < n; i++)
        {
            scanf(
"%d%d"&u, &v);
            tree[u].push_back(v);
            indegree[v]
++;
        }
        scanf(
"%d%d"&u, &v);
        que[u].push_back(v);
        que[v].push_back(u);
        
for (i = 1; i <= n; i++)
        {
            
if (indegree[i] == 0)
            {
                lca(i);
                
break;
            }
        }
    }
    
return 0;
}



]]>
pku 3264 鈥斺攔mq闂鐨剆t綆楁硶http://m.shnenglu.com/Ylemzy/articles/121703.html鐏⒊榛?/dc:creator>鐏⒊榛?/author>Fri, 30 Jul 2010 07:35:00 GMThttp://m.shnenglu.com/Ylemzy/articles/121703.htmlhttp://m.shnenglu.com/Ylemzy/comments/121703.htmlhttp://m.shnenglu.com/Ylemzy/articles/121703.html#Feedback0http://m.shnenglu.com/Ylemzy/comments/commentRss/121703.htmlhttp://m.shnenglu.com/Ylemzy/services/trackbacks/121703.htmlrmq鑼冨洿鏈灝忥紙澶э級鎸囬棶棰樷斺斿鐞嗗浜巒涓暟錛岃姹傚揩閫熸眰鍑烘煇鍖洪棿鍐呯殑鏈鍊箋?/span>
f[i][j]琛ㄧず浠涓鴻搗鐐歸暱搴︿負2^j鐨勬渶鍊箋?/span>
f[i][j] = rmq(f[i][j-1], f[i + 2 ^ (j-1)][j-1];鐩稿綋浜庢妸綰挎鍒嗘垚鐩哥瓑鐨勫乏鍙充袱孌靛悎騫舵眰rmq銆備絾榪欏緱璁╃嚎孌甸暱搴︽槸2鐨勫箓嬈°?/span>
鏌ヨ鏃訛紝渚嬪f[1錛?] = f[1][2] + f[5][1] + f[7][0];涓篛(logn),f[1, 7]瀵瑰簲浜庢暟緇勪腑鐨勫尯闂?/span>
涓轟簡鍔犲揩鏌ヨ錛屽彲浣縡[1錛?] = f[1][2] + f[4][2];涓篛(1)錛岃繖閲岀敤2=錛?^k <= 7錛塳鐨勬渶澶у? - 2^2 + 1 涓?錛屽嵆璁?鍚戝乏縐誨姩2^2 - 1涓綅錛?^k = 1 << k;娉ㄦ剰錛氫緥濡傜粰鍑簄=7錛屽垯f[4][2]鏄眰瀵瑰簲浜嶽4, 8]鐨剅mq錛岃宖[4, 8] = f[4, 7],鎵浠ヨ瀵規榪涜棰勫鐞?璁╁彸鍖洪棿鐨勫艱秴榪噉鐨勪負鍙沖尯闂翠負n鏃剁殑鍊鹼紝榪欐牱鎵嶈兘鍔犲揩鏌ヨ錛屽嵆澶氬鍔犱簡涓浜涙柟渚挎煡璇㈢殑鏁版嵁銆傛渶澶у乏縐繪槸k = log2(n),鍙〃紺虹殑鏈澶ц搗濮嬬偣鏄? << k,鍒檉[i][j]琛ㄧず鐨勫彸鍖洪棿鐨勬渶澶у間負
(1 << k) + (1 << k) = 1 << (k + 1) = 2 ^ (log2(n) + 1),鎻愪緵榪欎釜鏁版嵁鏃惰兘緇欏嚭浣曟椂寰楃┖闂碵n + 1][log2(n) + 1 + 1]銆?/span>
浠g爜錛?/span>

#include  < stdio.h >
#include 
< stdlib.h >
#include 
< math.h >
#define  maxn 50010
#define  Min(a, b) a < b ? a : b
#define  Max(a, b) a > b ? a : b
struct  t
{
    
int  min, max;
}map[maxn][
20 ];
void  build ( int  n)
{
    
int  i, j, m, r  =  n, c  =  log(( double )n)  /  log( 2.0 );
    
for  (i  =   1 ; i  <=  c; i ++ )
    {
        
for  (j  =   1 ; j  <=  r; j ++ )
        {
            m 
=  j  +  ( 1   <<  (i  -   1 )); // 鍙沖崐閮ㄥ垎鐨勮搗濮嬪?/span>
             if  (m  <=  r)
            {
                map[j][i].min 
=  Min(map[j][i - 1 ].min ,map[m][i - 1 ].min);
                map[j][i].max 
=  Max(map[j][i - 1 ].max, map[m][i - 1 ].max);
            }
            
else // 闀垮害瓚呭嚭n鐨勶紝灝卞綋鏄痡璧風偣鐨勬渶鍚庝竴涓粓鐐圭殑rmq銆傚疄鐜拌繖姝ヨ兘浣挎煡璇負O(1).
            {
                map[j][i].min 
=  map[j][i - 1 ].min;
                map[j][i].max 
=  map[j][i - 1 ].max;
            }
        }
    }
}
int  query( int  l,  int  r)
{
    
int  len  =  r  -  l  +   1 ;
    
int  k  =  log(( double )len)  /  log( 2.0 );
    
int  m  =  r  -  ( 1   <<  k)  +   1 ;
    
int  min  =  Min(map[l][k].min, map[m][k].min);
    
int  max  =  Max(map[l][k].max, map[m][k].max);
    
return  max  -  min;
}
int  main()
{
    
int  n, m,  i, l, r;
    scanf(
" %d%d " & n,  & m);
    
for  (i  =   1 ; i  <=  n; i ++ )
    {
        scanf(
" %d " & map[i][ 0 ].min);
        map[i][
0 ].max  =  map[i][ 0 ].min;
    }
    build (n);
    
while  (m -- )
    {
        scanf(
" %d%d " & l,  & r);
        printf(
" %d\n " , query(l, r));
    }
    
return   0 ;
}



]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲视频一二区| 亚洲国产精品久久精品怡红院 | 午夜精品久久久久久久久久久| 国产精品国色综合久久| 欧美在线你懂的| 9色精品在线| 欧美成人黄色小视频| 亚洲淫片在线视频| 一本色道精品久久一区二区三区 | 亚洲美女一区| 国产欧美韩日| 欧美日韩一区成人| 久久激情综合网| 欧美影院在线| 亚洲无玛一区| 久久成人亚洲| 久久久久成人精品免费播放动漫| 性欧美1819性猛交| 亚洲综合另类| 亚洲午夜在线观看视频在线| 性久久久久久久久| 久久亚洲欧洲| 久久综合五月天婷婷伊人| 久久精品主播| 亚洲三级视频在线观看| 日韩亚洲一区二区| 亚洲午夜羞羞片| 久久精品综合| 国产精品hd| 亚洲最黄网站| 欧美亚洲在线视频| 欧美日韩精品在线视频| 国产精品一区二区黑丝| 国内免费精品永久在线视频| 在线日韩成人| 久久久久一区二区| 欧美激情偷拍| 久久免费视频在线| 国产精品免费看久久久香蕉| 亚洲国产国产亚洲一二三| 亚洲欧美国产高清| 99精品久久久| 鲁鲁狠狠狠7777一区二区| 国产精品日韩欧美| 最新69国产成人精品视频免费| 99精品视频免费观看视频| 欧美成人免费大片| 久久三级视频| 亚洲国产欧洲综合997久久| 老妇喷水一区二区三区| 久久精品国产久精国产思思| 国产视频在线观看一区二区三区 | 欧美成人国产一区二区| 国产精品一区在线观看你懂的| 99视频超级精品| 欧美一级午夜免费电影| 西西裸体人体做爰大胆久久久| 亚洲国产片色| 午夜久久资源| 欧美中文字幕在线观看| 国产精品不卡在线| 国外成人在线视频网站| 99精品国产在热久久婷婷| 99国产精品视频免费观看一公开 | 欧美主播一区二区三区美女 久久精品人| 亚洲综合精品| 亚洲激情欧美激情| 久久久精品欧美丰满| 午夜久久福利| 欧美日韩第一区日日骚| 亚洲一区国产精品| 欧美一区二区三区在线观看视频| 国产日韩欧美中文| 一区二区三区高清在线| 国产欧美亚洲精品| 欧美永久精品| 欧美日韩国产在线| 欧美成人tv| 韩国在线一区| 99精品欧美一区二区蜜桃免费| 国产一区二区| 亚洲精品视频在线播放| 亚洲第一页在线| 亚洲天堂男人| 亚洲精品之草原avav久久| 久久久久久成人| 久久三级视频| 国产日产欧美一区| 亚洲网站啪啪| 久久久久在线| 伊人激情综合| 欧美精品一区三区在线观看| 久热这里只精品99re8久| 国产一区二区三区日韩| 日韩视频在线免费观看| 午夜国产一区| 国产精品欧美久久| 亚洲国产日韩欧美| 欧美日本在线播放| 一区二区三区四区国产| 亚洲欧美日韩爽爽影院| 国产精品白丝jk黑袜喷水| 亚洲一区在线视频| 亚洲综合视频1区| 国产欧美亚洲一区| 国产精品日本一区二区| 亚洲国产日韩欧美综合久久| 欧美一区精品| 久久xxxx精品视频| 欧美一区二区三区免费大片| 亚洲一区二区三区免费视频| 韩日视频一区| 国产精品久久亚洲7777| 开心色5月久久精品| 久久久精品国产99久久精品芒果| 日韩视频在线一区| 91久久精品国产91久久| 欧美大片免费观看| 老色鬼精品视频在线观看播放| 欧美中文在线视频| 欧美在线精品免播放器视频| 亚洲在线日韩| 欧美在线www| 美国成人毛片| 亚洲国产色一区| 亚洲最新视频在线播放| 国产精品99久久久久久久女警| av不卡免费看| 欧美一区二区视频网站| 久久人体大胆视频| 欧美高清视频在线| 欧美精品aa| 国产拍揄自揄精品视频麻豆| 国产一区亚洲| 一区二区欧美精品| 久久国产加勒比精品无码| 麻豆精品视频在线观看视频| 亚洲一区二区在| 欧美电影在线播放| 欧美一区二区免费| 蜜桃久久精品乱码一区二区| 亚洲一区二区三区高清| 一区二区国产精品| 在线观看成人av| 在线一区日本视频| 亚洲激情视频网站| 久久黄色网页| 久久精品久久综合| 国产精品毛片a∨一区二区三区|国| 欧美成人免费小视频| 欧美图区在线视频| 欧美福利电影在线观看| 日韩视频免费观看| 一区二区免费在线播放| 女女同性女同一区二区三区91| 日韩视频免费在线| 久久人人九九| 欧美在线亚洲一区| 国产精品亚洲视频| 一区二区三区成人精品| 在线中文字幕日韩| 欧美不卡三区| 亚洲国产天堂久久综合网| 亚洲大黄网站| 欧美不卡视频一区发布| 欧美国产日本韩| 亚洲精品在线视频观看| 欧美日韩一二三四五区| 亚洲一区图片| 麻豆久久精品| 夜色激情一区二区| 欧美国产国产综合| 国产欧美一区二区视频| 欧美劲爆第一页| 欧美一级成年大片在线观看| 男女视频一区二区| 久久国产精品99国产| 中国成人黄色视屏| 在线色欧美三级视频| 亚洲精品久久久蜜桃| 亚洲福利专区| 欧美日韩中文字幕日韩欧美| 小处雏高清一区二区三区| 欧美一区二区黄色| 老色鬼久久亚洲一区二区| 国产精品白丝av嫩草影院| 男男成人高潮片免费网站| 一区二区三区视频在线播放| 欧美日韩综合不卡| 亚洲美女视频| 欧美一区二区大片| 国产欧美一区二区精品婷婷| 亚洲国产精品高清久久久| 激情一区二区三区| 欧美日韩久久| 蜜桃av噜噜一区| 国产精品一区二区视频| 欧美一区二区三区另类| 欧美制服丝袜| 亚洲精选成人|