Buses and People CodeForces 160E 三维偏序+线段树 题意 给定 N 个三元组 (a,b,c),现有 M 个询问,每个询问给定一个三元组 (a',b',c'),求满足 a<a', b'<b, c'<c 的最小 c 对应的元组编号. 解题思路 三维偏序问题,是我第一次做,查的题解. 一位大佬是这么说的,原博客首先,离线处理所有询问,将这 N+M 个元组按照 a 从小到达进行排序,若有相同的 a,则给定元组应该排在询问元组之前.排序后即可保证对于任意一个询问元组…
D. Zigzag time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The court wizard Zigzag wants to become a famous mathematician. For that, he needs his own theorem, like the Cauchy theorem, or hi…
G. Raffles time limit per test:5 seconds memory limit per test:256 megabytes input:standard input output:standard output Johnny is at a carnival which has n raffles. Raffle i has a prize with value pi. Each participant can put tickets in whichever ra…
题面 传送门:http://codeforces.com/problemset/problem/833/B B. The Bakery time limit per test2.5 seconds memory limit per test256 megabytes inputstandard input outputstandard output Some time ago Slastyona the Sweetmaid decided to open her own bakery! She…
E. XOR on Segment You've got an array a, consisting of n integers a1, a2, ..., an. You are allowed to perform two operations on this array: Calculate the sum of cu…
Chemistry Experiment 维护一个权值线段树,然后二分答案. #include<bits/stdc++.h> #define LL long long #define LD long double #define ull unsigned long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL,…
You are given a rooted tree with root in vertex 1. Each vertex is coloured in some colour. Let's call colour c dominating in the subtree of vertex v if there are no other colours that appear in the subtree of vertex v more times than colour c. So it'…
Parking Lot 线段树区间合并一下, 求当前要占的位置, 不包括两端点的写起来方便一点. #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> #define PII pair<int, int> #de…