You are given a list of train stations, say from the station 111 to the station 100100100. The passengers can order several tickets from one station to another before the train leaves the station one. We will issue one train from the station 111 to t…
You are given a list of train stations, say from the station 11 to the station 100100. The passengers can order several tickets from one station to another before the train leaves the station one. We will issue one train from the station 11 to the st…
In this problem, we will define a graph called star graph, and the question is to find the minimum distance between two given nodes in the star graph. Given an integer nnn, an n−dimensionaln-dimensionaln−dimensional star graph, also referred to as Sn…
There are nnn rectangles on the plane. The problem is to find the area of the union of these rectangles. Note that these rectangles might overlap with each other, and the overlapped areas of these rectangles shall not be counted more than once. For e…
Let SSS be a sequence of integers s1s_{1}s​1​​, s2s_{2}s​2​​, ........., sns_{n}s​n​​ Each integer is is associated with a weight by the following rules: (1) If is is negative, then its weight is 000. (2) If is is greater than or equal to 10000100001…
2017 ACM-ICPC 亚洲区(南宁赛区)网络赛  M. Frequent Subsets Problem 题意:给定N和α还有M个U={1,2,3,...N}的子集,求子集X个数,X满足:X是U的子集且出现在M个子集中的次数>=α*M. 题解:因为N<=20,所以U的子集个数最大不过2^20.所以采用二进制把每个子集M映射压缩成一个数,比如: M={1,4,8,10}==>2^(1-0)+2^(4-1)+2^(8-1)+2^(10-1)=1+8+128+512=649(映射记为f,…
描述 You are given a list of integers a0, a1, …, a2^k-1. You need to support two types of queries: 1. Output Minx,y∈[l,r] {ax∙ay}. 2. Let ax=y. 输入 The first line is an integer T, indicating the number of test cases. (1≤T≤10). For each test case: The fi…
描述 Ming is going to travel for n days and the date of these days can be represented by n integers: 0, 1, 2, …, n-1. He plans to spend m consecutive days(2 ≤ m ≤ n)in Beijing. During these m days, he intends to use the first day and another day to vis…
HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011 亚洲北京赛区网络赛题目) Eliminate Witches! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 863    Accepted Submission(s): 342 Problem Description Kaname Mado…
HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1816    Accepted Submission(s): 632 Problem Description When I wrote down this letter, you may have…
ACM-ICPC 2018 徐州赛区网络赛  去年博客记录过这场比赛经历:该死的水题  一年过去了,不被水题卡了,但难题也没多做几道.水平微微有点长进.     D. Easy Math 题意:   给定 \(n\), \(m\) ,求 \(\sum _{i=1}^{m} \mu(in)\) .其中 $ 1 \le n \le 1e12$ , $ 1 \le m \le 2e9$ ,\(\mu(n)\) 为莫比乌斯函数.   思路:   容易知道,\(i\) 与 \(n\) 不互质时, \(\m…
题目链接 网络赛的水实在太深,这场居然没出线zzz,差了一点点,看到这道题的的时候就剩半个小时了.上面是官方的题意题解,打完了才知道暴力就可以过,暴力我们当时是想出来了的,如果稍稍再优化一下估计就过了zzz.去年有一场现场赛也是n=1000,n^3过了,看来关键时刻实在做不出来就得大胆暴力啊. #include <bits/stdc++.h> using namespace std; typedef long long ll; ; int a[maxn],nex[maxn]; int main…
目录 A. Hard to prepare B.BE, GE or NE F.Features Track G.Trace H.Ryuji doesn't want to study I.Characters with Hash J. Maze Designer A. Hard to prepare After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver…
D.Made In Heaven One day in the jail, F·F invites Jolyne Kujo (JOJO in brief) to play tennis with her. However, Pucci the father somehow knows it and wants to stop her. There are NN spots in the jail and MM roads connecting some of the spots. JOJO fi…
You are given a list of train stations, say from the station 1 to the station 100. The passengers can order several tickets from one station to another before the train leaves the station one. We will issue one train from the station 1 to the station…
题意:一个长为L的河,中间有n个石子,小青蛙需要跳少于m次过河,判断小青蛙每次跳跃最大距离的最小值 最大值最小,用二分 Sample Input 6 1 2 2 25 3 3 11 2 18 Sample Output 4 11   2015-07-27:备战区域赛专题 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath>…
先最大流跑一遍 在残存网络上把满流边容量+1 非满流边容量设为无穷大 在进行一次最大流即可 (这里的边都不包括建图时用于反悔的反向边) #include<cstdio> #include<cstring> #include<cstdlib> #include<queue> #include<iostream> #define rep(i,a,b) for(int i=a;i<=b;++i) using namespace std; ; in…
为迎接10月17号清华命题的鞍山现场赛 杭电上的题目 Biconnected(hdu4997)     状态压缩DP Rotate(hdu4998)    相对任一点的旋转 Overt(hdu4999)   Clone(hdu5000)   DP Walk(hdu5001)   DP Tree(hdu5002)   Osu!(hdu5003)   热身题 KAMI(hdu5004)   The Ghost Blows Light   USACO ORZ   2013/8/27…
题目链接 #include <iostream> #include <math.h> #include <stdio.h> #include<algorithm> #include<cstring> #include<queue> using namespace std; ]; int main() { int T,n,t; scanf("%d",&T); while(T--) { int tmp; sca…
题目链接 题意:有一壶水, 体积在 L和 R之间, 有两个杯子, 你要把水倒到两个杯子里面, 使得杯子水体积几乎相同(体积的差值小于等于1), 并且使得壶里剩下水体积不大于1. 你无法测量壶里剩下水的体积, 问最小需要倒水的次数. 题解:考虑倒水的大致过程,L = 0 和 L = 1 的情况应该是等价的,所以不妨设 L > 0.首先向一个杯子倒 L/2 升水,再往另一个杯子倒  L/2+1 升水.接下来就来回往两个杯子里倒 2 升,直到倒空为止.这样就很容易分析出需要倒水的次数.唯一注意的是最后…
题目链接 题意:给定一个数n,求大于n的第一个只包含2357四个因子的数(但是不能不包含其中任意一种),求这个数. 题解:打表+二分即可. #include <iostream> #include <math.h> #include <stdio.h> #include<algorithm> using namespace std; ],tot=; int main() { ; long long a,b,c,d; ;a<=maxn;a*=) ;a*b…
题目链接 题意:给定一个数n,求1到n中的每一项的平方分之一的累加和. 题解:题目没有给数据范围,而实际上n很大很大超过long long.因为题目只要求输出五位小数,我们发现当数大到一定程度时值是固定的 pi*pi/6.小的打表就行了,这里打表为了防止爆内存我用了优化的方法,类似于我之前写的light oj 1234. #include <iostream> #include <math.h> #include <stdio.h> #include <cstri…
题目链接 #include <map> #include <queue> #include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <algorithm> #include <iostream> using namespace std; ]; ; long long quick(long long…
题目链接 题意:一个数字,它每个数位上的奇数都形成偶数长度的段,偶数位都形成奇数长度的段他就是好的.问[L , R]的好数个数. 题解:裸的数位dp, 从高到低考虑每个数位, 状态里存下到当前位为止的值的奇偶性和长度奇偶性即可. #include <iostream> #include <vector> #include <string.h> #include <stdio.h> #include <queue> using namespace…
题目链接 题意:求[1,n]有多少个素数,1<=n<=10^11.时限为6000ms. 官方题解:一个模板题, 具体方法参考wiki或者Four Divisors. 题解:给出两种代码. 第一种方法Meisell-Lehmer算法只需265ms. 第二种方法不能运行但是能AC,只需35行. 第一种: //Meisell-Lehmer #include<cstdio> #include<cmath> using namespace std; #define LL long…
看到范围基本可以想到dp了,处理起来有点麻烦 #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<map> #include<queue> #include<stack> #include<cmath> #include<vector> #d…
和以前做过的一个二分图颇为相似,以前的是互相不认识的放在一组,这个是互相认识的,本质上是相同的 是 hdu 2444 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #include<map> using namespace std; typedef long…
起点忘记录了,一直wa 代码写的很整齐,看着很爽 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #include<map> using namespace std; #define MOD 1000000007 const int INF=0x3f3f3f3f…
是平行坐标轴的,排个序搞一下就行了,卧槽,水的不行 如果不是平行的,则需要按照边长来判断…
题意:有n座岛和m条桥,每条桥上有w个兵守着,现在要派不少于守桥的士兵数的人去炸桥,只能炸一条桥,使得这n座岛不连通,求最少要派多少人去. 处理重边 边在遍历的时候,第一个返回的一定是之前去的边,所以这条边忽略,然后继续遍历,此时可以通过未遍历的边返回pre #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #incl…