题意:给你n个数,一次操作可以选一个数delete,代价为x:或者选一个数+1,代价y.你可以进行这两种操作任意次,让你在最小的代价下,使得所有数的GCD不为1(如果全删光也视作合法). 我们从1到max(ai)枚举最后都变成的gcd是多少,假设为g,那么所有数都必须变成一个比g大的最小的g的倍数k·g.枚举k,然后在一个区间[(k-1)*g+1,k*g]里,一定存在一个分界点f,使得小于等于f的数全都删去,因为删除的代价小于把它们都变成kg的代价:大于f的数全都变成kg.因为x<=(kg-ai…
题意 一个竞赛图的度数集合是由该竞赛图中每个点的出度所构成的集合. 现给定一个 \(m\) 个元素的集合,第 \(i\) 个元素是 \(a_i\) .(此处集合已经去重) 判断其是否是一个竞赛图的度数集合,如果是,找到点数最小的满足条件的竞赛图,并构造方案. \(m, a_i \le 30\) ,\(a_i\) 互不相同. 题解 首先给出结论:假如给出每个点的出度,那么这些点能形成一个竞赛图当且仅当排序后的序列 \(d_1, d_2, d_3, \dots , d_n\) 满足对于所有 \(k…
http://codeforces.com/contest/851/problem/D 分区间操作 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <time.h> #include <string> #include <set> #include <map> #include <list&…
题意:给你五维空间内n个点,问你有多少个点不是坏点. 坏点定义:如果对于某个点A,存在点B,C,使得角BAC为锐角,那么A是坏点. 结论:如果n维空间内已经存在2*n+1个点,那么再往里面添加任意多个点,就会导致所有点都变成坏点. 容易看出来(?),把2*n+1个点分别放在原点处和每个坐标轴的正负半轴上各一个比较优. 所以n>11时,直接输出零,否则暴力枚举. #include<cstdio> using namespace std; typedef long long ll; stru…
A. Arpa and a research in Mexican wave time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Arpa is researching the Mexican wave. There are n spectators in the stadium, labeled from 1 to n. They…
题意:给你平面上3个不同的点A,B,C,问你能否通过找到一个旋转中心,使得平面绕该点旋转任意角度后,A到原先B的位置,B到原先C的位置. 只要A,B,C构成等腰三角形,且B为上顶点.那么其外接圆圆心即是一个合法的旋转中心.画个图很显然. 注意A,B,C三点共线时不可. #include<cstdio> using namespace std; typedef long long ll; struct Point{ ll x,y; Point(const ll &x,const ll &…
Arpa has found a list containing n numbers. He calls a list bad if and only if it is not empty and gcd (see notes section for more information) of numbers in the list is 1. Arpa can perform two types of operations: Choose a number and delete it with…
You are given set of n points in 5-dimensional space. The points are labeled from 1 to n. No two points coincide. We will call point a bad if there are different points b and c, not equal to a, from the given set such that angle between vectors  and …
Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points a, b, c. Find a point and an angle such that if we rotate the page around the point by the angle, the new position of a is the same as the old position o…
Arpa is researching the Mexican wave. There are n spectators in the stadium, labeled from 1 to n. They start the Mexican wave at time 0. At time 1, the first spectator stands. At time 2, the second spectator stands. ... At time k, the k-th spectator…