题目描述 Peter returned from the recently held ACM ICPC World finals only to find that his return flight was overbooked and he was bumped from the flight! Well, at least he wasn’t beat up by the airline and he’s received a voucher for one free flight bet…
目录 ICPC North Central NA Contest 2018 1. 题目分析 2. 题解 A.Pokegene B.Maximum Subarrays C.Rational Ratio D.Travel the Skies E. Euler's Number F. Lipschitz Constant G. Tima goes to Xentopia H. New Salaries I. Other Side J.Kaleidoscopic Palindromes ICPC Nor…
1570: [JSOI2008]Blue Mary的旅行 Time Limit: 15 Sec  Memory Limit: 162 MBSubmit: 388  Solved: 212[Submit][Status][Discuss] Description 在一段时间之后,网络公司终于有了一定的知名度,也开始收到一些订单,其中最大的一宗来自B市.Blue Mary决定亲自去签下这份订单.为了节省旅行经费,他的某个金融顾问建议只购买U航空公司的机票.U航空公司的所有航班每天都只有一班,并且都是…
https://open.kattis.com/problems/researchproductivityindex 这道题是考场上没写出来的一道题,今年看看感觉简单到不像话,当时自己对于dp没有什么概念,所以导致考场只能空流泪 首先问期望,肯定就要确定概率.看到这个 就知道肯定一块求是不太好写的,先求上面,上面求发表的期望,那么对于期望我们有e(x) = Σxipi 这里p知道了但是xi不知道,那么我们根据题目描述我们有一个分子一个分母,分子是发表的次数,分母是论文数,首先对于任何j篇论文发表…
NAIPC 2017 Yin and Yang Stones 75.39% 1000ms 262144K   A mysterious circular arrangement of black stones and white stones has appeared. Ming has been tasked with balancing the stones so that only one black and one white stone remain. Ming has two ope…
A family of nn gnomes likes to line up for a group picture. Each gnome can be uniquely identified by a number 1..n1..n written on their hat. Suppose there are 55 gnomes. The gnomes could line up like so: 1, 3, 4, 2, 51,3,4,2,5. Now, an evil magician…
Consider an n \times mn×m matrix of ones and zeros. For example, this 4 \times 44×4: \displaystyle \begin{matrix} 1 & 1 & 1 & 1 \\ 0 & 1 & 1 & 1 \\ 0 & 1 & 1 & 1 \\ 0 & 1 & 1 & 0 \end{matrix}1000​1111​1111​1…
Consider nn initial strings of lower case letters, where no initial string is a prefix of any other initial string. Now, consider choosing kk of the strings (no string more than once), and concatenating them together. You can make this many such comp…
目录 2018-2019 ICPC, NEERC, Southern Subregional Contest (Codeforces 1070) A.Find a Number(BFS) C.Cloud Computing(线段树) D.Garbage Disposal(模拟) E.Getting Deals Done(二分) F.Debate(贪心) H.BerOS File Suggestion(后缀自动机) I.Privatization of Roads in Berland(网络流)…
ACM ICPC Central Europe Regional Contest 2013 Jagiellonian University Kraków Problem A: Rubik’s RectangleProblem B: What does the fox say?Problem C: Magical GCDProblem D: SubwayProblem E: EscapeProblem F: DraughtsProblem G: History courseProblem H: C…
2018-2019 ICPC, NEERC, Southern Subregional Contest 闲谈: 被操哥和男神带飞的一场ACM,第一把做了这么多题,荣幸成为7题队,虽然比赛的时候频频出锅,差点被鸽,但还算打完了5h 总的来说这场还是不算难的,7题还是少了点 A 题目: 给出a,b,求出一个数满足是a的倍数,且数字和为b 题解: 男神懒得写博客就甩锅了 直接宽搜,宽搜时队列中的状态保存为x,y,x表示当前的数%a==x,y表示数字和 然后记录状态和方案就行了 参考代码: #inclu…
2017 Chinese Multi-University Training, BeihangU Contest Add More Zero 思路:log10(2^m) = m*log10(2) 代码: #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize(4) #include<bits/stdc++.h> using namespace std; #define y1 y11 #define fi firs…
2019-2020 ICPC, Asia Jakarta Regional Contest (Online Mirror, ICPC Rules, Teams Preferred) easy: ACEGHK medium-easy: BJL medium: D ?????: I A. B. C. 对 \(R[],C[]\) 分别按奇偶性分段. 网! D. 考虑 check 一个串,枚举右走对应的前缀 pre,下走对应的后缀 suf. 把每行反串拼接中间连特殊字符,建 SA,能 match 上 p…
题目链接: 2018 ICPC Pacific Northwest Regional Contest - I-Inversions 题意 给出一个长度为\(n\)的序列,其中的数字介于0-k之间,为0表示这个位置是空的.现在可以在这些空的位置上任意填入1-k之间的数字(可以重复).问最多可以总共有多少对逆序对.(如果\(i<j,p_i>p_j\),则称\((i,j)\)是一对逆序对) \(1\leq n\leq 2*10^5,\ 1\leq k\leq 100\) 思路 第一步,先证明最优的填…
用线段树维护建图,即把用线段树把每个区间都标号了,Tree1中子节点有到达父节点的单向边,Tree2中父节点有到达子节点的单向边. 每次将源插入Tree1,汇插入Tree2,中间用临时节点相连.那么Tree1中的所用子节点都可以到达,Tree2中的所用子节点. 感觉很有道理啊,以前从来没用用线段树这样维护过建图.分层图最短路没有像BZOJ2763可以直接向先一层连边,因为边已经很多了. #include <cstdio> #include <iostream> #include &…
分析:(官方题解) 首先考虑暴力,显然可以直接每次O(n^2) ​的连边,最后跑一次分层图最短路就行了. 然后我们考虑优化一下这个连边的过程 ,因为都是区间上的操作,所以能够很明显的想到利用线段树来维护整个图, 连边时候找到对应区间,把线段树的节点之间连边.这样可以大大缩减边的规模,然后再跑分层图最短路就可以了. 但是这样建图,每一次加边都要在O(logn)个线段树节点上加边,虽然跑的非常快,但是复杂度仍然是不科学的. 为了解决边的规模的问题,开两棵线段树,连边时候可以新建一个中间节点,在对应区…
(待补) A. Pieces of Parentheses 将括号处理完成后排序,方式参加下面的博客.然后做一遍背包即可. 2018 Multi-University Training Contest 1 Balanced Sequence(贪心) #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using namespace std; const i…
A. Cut it Out! 枚举第一刀,那么之后每切一刀都会将原问题划分成两个子问题. 考虑DP,设$f[l][r]$表示$l$点顺时针一直到$r$点还未切割的最小代价,预处理出每条边的代价转移即可. 时间复杂度$O(n^3)$. #include<cstdio> #include<cmath> #include<algorithm> using namespace std; const int N=422; const double eps=1e-8; const…
A .Abstract Art 题意:求多个多边形的面积并. 思路:模板题. #include<bits/stdc++.h> using namespace std; typedef long long ll; const double inf=1e200; ; *atan(1.0); :(x<?-:);} struct point{ double x,y; point(,):x(a),y(b){} }; point operator +(point A,point B) { retur…
A:Abstract Art 题意:给出n个多边形,求n个多边形分别的面积和,以及面积并 思路:模板 #include <bits/stdc++.h> using namespace std; #define N 1010 #define mkp make_pair ; inline int sgn(double x) { ; ) ; ; } struct Point { double x, y; inline Point() {} inline Point(double x, double…
(待补) A. Fancy Antiques 爆搜. B. Alternative Bracket Notation C. Greetings! D. Programming Team 0/1分数规划 + 树上依赖型背包. E. K-Inversions 将 A 和 B 的相对位置看做多项式,用FFT,最后统计系数. #include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); struct comp{…
cable cable cable Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 278    Accepted Submission(s): 224 Problem Description Connecting the display screen and signal sources which produce different…
https://icpc.baylor.edu/regionals/finder/north-america-qualifier-2015 一个人打.... B 概率问题公式见代码 #include <cstdio> #include <cstring> #include <iostream> #include <queue> #include <stack> #include <vector> #include <algori…
Covering Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 187    Accepted Submission(s): 107 Problem Description Bob's school has a big playground, boys and girls always play games here after sch…
题目链接 problem description 5 friends play LOL together . Every one should BAN one character and PICK one character . The enemy should BAN 55 characters and PICK 55 characters . All these 2020 heroes must be different . Every one can BAN any heroes by h…
题目:https://vj.69fa.cn/12703be72f729288b4cced17e2501850?v=1552995458 dp这个题目网上说是dp+离散化这个题目要对这些数字先处理然后进行dp,这个处理值得学习一下,就是把数字范围为1~1e9,转化成一个顺序列表,这个顺序列表每一个不同的位置含有不同的难度,dp[i][j]代表前面i种选出j种的方案数. #include <cstdio> #include <iostream> #include <cstdlib…
题目连接 Problem There is a tree with n nodes. For each node, there is an integer value ai, (1≤ai​≤1,000,000,000 for 1≤i≤n). There is q queries which are described as follow: Assume the value on the path from node a to node b is t0​,t1​,⋯tm​. You are sup…
目录 Contest Info Solutions A. Copying Homework C. Even Path E. Songwriter G. Performance Review H. Twin Buildings J. Tiling Terrace K. Addition Robot Contest Info Practice Link Solved A B C D E F G H I J K L 7/12 O - O - O - O O - O O - O 在比赛中通过 Ø 赛后通…
链接:https://nanti.jisuanke.com/t/A1607 题面:   Consider an array AA with n elements . Each of its element is A[i]A[i] (1 \le i \le n)(1≤i≤n) . Then gives two integers QQ, KK, and QQ queries follow . Each query , give you LL, RR, you can get ZZ by the fo…
As you might already know, space has always been a problem in ICPC Jakarta. To cope with this, ICPC Jakarta is planning to build two new buildings. These buildings should have a shape of a rectangle of the same size. Now, their problem is to find lan…