https://codeforc.es/problemset/problem/6/E 既然可以多个log,那就直接map伺候.尺取之后要查询区间里面的最大值和最小值的差.众所周知尺取的时候要是不是有序序列,不可能方便地维护极值.(或者不用map以及平衡树的话,那就用线段树,每次update一个数量,然后RMQ最值,线段树(假如不是这个范围)还得先离散化,非常傻逼). #include<bits/stdc++.h> using namespace std; typedef long long l…
E. Exposition time limit per test 1.5 seconds memory limit per test 64 megabytes input standard input output standard output There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local…
E. Exposition Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/6/E Description There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection the local library d…
[题目链接] https://codeforces.com/contest/620/problem/E [算法] 显然 , 一棵子树的DFS序必然为连续的一段 用线段树维护颜色数即可 [代码] #include<bits/stdc++.h> using namespace std; ; struct edge { int to , nxt; } e[MAXN << ]; int n , m , tot , timer; int a[MAXN],dfn[MAXN],pos[MAXN]…
题目链接: http://codeforces.com/contest/6/problem/E E. Exposition time limit per test 1.5 secondsmemory limit per test 64 megabytes 问题描述 There are several days left before the fiftieth birthday of a famous Berland's writer Berlbury. In this connection th…
题目链接: http://codeforces.com/contest/731/problem/A A. Night at the Museum time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Grigoriy, like the hero of one famous comedy film, found a job as a…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…