转载请注明出处:http://blog.csdn.net/u012860063 题目链接:http://codeforces.com/problemset/problem/52/C You are given circular array a0, a1, ..., an - 1. There are two types of operations with it: inc(lf, rg, v) - this operation increases each element on the segm…
线段树区间更新维护最小值...记得下放标记... 如果线段树上的一个完整区间被修改,那么最小值和最大值增加相应的值后不变, 会改变是因为一部分改变而另外一部分没有改变所以维护一下就好. 询问的时候也要记得下放标记... 数据结构快忘了,贴个板. #include<bits/stdc++.h> using namespace std; typedef long long ll; ; struct Seg { ll lazy; ll Min; }tr[maxn<<]; int a[ma…
更好的阅读体验 Portal Portal1: Codeforces Portal2: Luogu Description You are given circular array \(a_0, a_1, \cdots, a_{n - 1}\). There are two types of operations with it: \(\textrm{inc}(lf, rg, v)\) - this operation increases each element on the segment…
Description You are given circular array a0, a1, ..., an - 1. There are two types of operations with it: inc(lf, rg, v) - this operation increases each element on the segment [lf, rg] (inclusively) by v; rmq(lf, rg) - this operation returns minimal v…
Periodic RMQ Problem 动态开点线段树直接搞, 我把它分成两部分, 一部分是原来树上的, 一部分是后来染上去的,两个部分取最小值. 感觉有点难写.. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #…
Training address: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=38994#overview B.Xenia and Bit Operations ----Codeforces 339D 线段树大水题..每个节点维护一个flag,flag=1表示此时应与其兄弟节点做或(|)操作,flag=2表示做异或(^)操作,然后pushup... 代码: #include <iostream> #include <cst…
题目链接: B. Strip time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right. Now Alexandra wants to split it into…
B. Prison Transfer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/427/B Description The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c…
Friends and Subsequences 题目链接: http://acm.hust.edu.cn/vjudge/contest/121333#problem/H Description Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today they have a problem they cannot solve on the…
An army of n droids is lined up in one row. Each droid is described by m integers a1, a2, ..., am, where ai is the number of details of thei-th type in this droid's mechanism. R2-D2 wants to destroy the sequence of consecutive droids of maximum lengt…
Strip time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alexandra has a paper strip with n numbers on it. Let's call them ai from left to right. Now Alexandra wants to split it into some piec…
E. Liar The first semester ended. You know, after the end of the first semester the holidays begin. On holidays Noora decided to return to Vičkopolis. As a modest souvenir for Leha, she brought a sausage of length m from Pavlopolis. Everyone know…
题目链接: D. Friends and Subsequences time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Toda…
传送门 题意: 有 n 个孩子编号为 1~n ,绕着圣诞树 dance: 编号为 i 的孩子可以记住ai1,ai2两个小孩,ai1,ai2是 i 在顺时针方向的相邻的两个小孩,但ai1,ai2不一定是按顺时针方向排列的: 给出每个孩子相邻两个孩子的信息,让你还原这个序列. 题解: 可以以任一孩子作为第一个孩子,假设以编号 1 为第一个,编号1有两个相邻的孩子信息 a,b 如果 b 在 a 的顺时针方向,那么第二个孩子就是 a,反之为 b. 确定了前两个孩子后 i 从 1 开始遍历,第 i 个孩子…