[题目链接]: Educational Codeforces Round 35 (Rated for Div. 2) A. Nearest Minimums time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array of n integer numbers a0, a1, ..., an -…
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define IT set<ll>::iterator #define sqr(…
A. Nearest Minimums time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array of n integer numbers a0, a1, ..., an - 1. Find the distance between two closest (nearest) minimum…
Nearest Minimums 相同的数里最小的数里的最小距离 Solution Two Cakes Solution Three Garlands 瞎比试 Solution Inversion Counting 先算出来最初逆序对个数,对于每次选择,如果选出的区间里数对个数为偶数个,则其中正序对和逆序对个数可能分别为(奇数+奇数)或(偶数+偶数),此时总的逆序对奇偶性不变:如果选出的区间里数对个数为奇数个,则其中正序对和逆序对个数可能分别为(奇数+偶数)或(偶数+奇数),此时总的逆序对奇偶性…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 找出最小的数字的位置. 最近的肯定是相邻的某对. [代码] #include <bits/stdc++.h> using namespace std; const int N = 1e5; int n; int a[N+10],mi; int main(){ #ifdef LOCAL_DEFINE freopen("rush_in.txt", "r", stdin); #endif io…
链接:http://codeforces.com/contest/665/problem/E 题意:求规模为1e6数组中,连续子串xor值大于等于k值的子串数: 思路:xor为和模2的性质,所以先预处理之后,可以枚举这种确实子串区间的方法为O(n^2): 优化?把每一个前缀xor扔到二叉树中,从根节点出发,以高位前缀值的二进制数构造一颗二叉树,这样就可以在构造的时候,实现对子树节点个数的求解:之后在线求解到当前节点的可选的前缀xor的个数, 即以k为主线 如果当前位k为1,则在前缀二叉树中只能找…
题目链接:http://codeforces.com/problemset/problem/598/C 题意是给你一个数n,下面n行,每行给你横坐标x和纵坐标y(x != 0 && y != 0).求当两个点与原点形成的角度最小时,是哪两个点. 先介绍atan2这个函数,atan2(double y,double x) 其中y代表已知点的Y坐标 同理x ,返回值是此点与远点连线与x轴正方向的夹角,这样它就可以处理四个象限的任意情况了,它的值域相应的也就是-180~180了. 我觉得最好还是…
Partial Tree Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem/C Description You are given the set of vectors on the plane, each of them starting at the origin. Your task is to find a pair of vectors with the mini…
B. Two Cakes 传送门:http://codeforces.com/contest/911/problem/B 本题是一个数学问题. 有a个Ⅰ类球,b个Ⅱ类球:有n个盒子.将球放入盒子中,要求: ①所有的球均被放入盒子中: ②每一个盒子中至少有一个球: ③一个盒子里至多只能有一类球. 设将所有的球放入盒子后,每个盒子里至少有x个球.求x的最大值. 由上述规则可知,一个盒子或放入Ⅰ类球,或放入Ⅱ类球.设放入Ⅰ类球的盒子数为i,放入Ⅱ类球的盒子数为j,则:i+j=n. 于是,为使盒子中放入…
C. Three Garlands time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mi…