B. Draw! time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You still have partial information about the score during the historic football match. You are given a set of pairs (ai,bi)(ai,bi),…
Codeforces Round #541 (Div. 2) http://codeforces.com/contest/1131 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define pb push_back #define eb emplace_back…
目录 Codeforces 1131 A.Sea Battle B.Draw! C.Birthday D.Gourmet choice(拓扑排序) E.String Multiplication(思路) F.Asya And Kittens(链表) G.Most Dangerous Shark Codeforces 1131 比赛链接 hack一个暴力失败了两次最后还是没成功身败名裂= = CF跑的也太快了吧... 不过倒也涨了不少. A.Sea Battle //想麻烦了,但是无所谓... #…
F. Asya And Kittens time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Asya loves animals very much. Recently, she purchased nn kittens, enumerated them from 11 and nn and then put them into…
C. Birthday time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Cowboy Vlad has a birthday today! There are nn children who came to the celebration. In order to greet Vlad, the children decided…
A. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In order to make the "Sea Battle" game more interesting, Boris decided to add a new ship type to it. The ship consists of…
不知道该更些什么 随便写点东西吧 https://codeforces.com/contest/1131 ABC 太热了不写了 D 把相等的用并查集缩在一起 如果$ x<y$则从$ x$往$y$连边 如果并查集内有边或边构成环则无解 否则做一遍拓扑输出答案 #include<cmath> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #de…
D. Gourmet choice 链接:http://codeforces.com/contest/1131/problem/D 思路: =  的情况我们用并查集把他们扔到一个集合,然后根据 > < 跑拓扑排序,根据拓扑排序的结果从小到大填数字就好了,需要注意的细节写在代码注释里了 代码: #include<bits/stdc++.h> using namespace std; ; int f[M],n,m; set<int>st[M]; vector<int&…
https://codeforces.com/contest/1131/problem/G 题意 给你一排m个的骨牌(m<=1e7),每块之间相距1,每块高h[i],推倒代价c[i],假如\(abs(i-j)<h[i]\),那么向j方向推倒i,j也会倒,问选择任意数量骨牌向任意方向推到,使得全部骨牌都倒下的代价最小 题解 连锁反应可以用单调栈或者链表模拟 定义dp[i]为推倒a[i,m]的最小代价 对于每个i,有两种选择: 向左推:\(dp[l[i]+1]=min(dp[l[i]+1],dp[…
https://codeforces.com/contest/1131/problem/D 题意 给你n个字符串,字符串长度总和加起来不会超过1e5,定义字符串相乘为\(s*s1=s1+s[0]+s1+s[1]+s1+...+s1+s[size-1]+s1+s[size]+s1\),求n个字符串依次相乘后最长连续字符相同的子序列长度 题解 鬼畜的题意 or 难以优化的复杂度,都需要观察性质才能做,第二串要插入第一个串每个字符之间,可以看出字符数增长的速度很快,所以并不能把整个字符存下来 只看一种…