题意: 给n,m,k,有n个点,m条线,距离都是一; 有k个特殊点,选择其中两个,进行相连,距离变为1,使得原本的最短路,经过相连改变小或者不变,最终结果是所有结果里面的最大距离。 思路: 选择i,j两个点(满足从1出发先遇到 i ,在遇到 j ),1~i+j~n+1就是新的最短路(1~i表示 1 ...
分类:
其他好文 时间:
2020-02-18 18:24:11
阅读次数:
60
网址:https://codeforces.com/contest/1303/problem/D 题意: 给出空间为$n$的容器和$m$个盒子。这些盒子的大小都是$2^k$的正整数,且可以减半,问使得容器刚好被盒子装满的最小减半次数是多少,如果不可能刚好装满,输出$-1$。 题解: 统计$2^k$大 ...
分类:
其他好文 时间:
2020-02-17 01:09:40
阅读次数:
90
Ayoub thinks that he is a very smart person, so he created a function f(s)f(s) , where ss is a binary string (a string which contains only symbols "0" ...
分类:
其他好文 时间:
2020-02-15 15:06:58
阅读次数:
55
dfs判断图的连通块数量~ #include<cstdio> #include<algorithm> #include<vector> #include<cstring> using namespace std; const int maxn=1e6+14; vector<int> g[maxn]; ...
分类:
其他好文 时间:
2020-02-13 22:59:25
阅读次数:
77
A 题意: 一串01字符串,求最少删掉几个0,使得1连续 思路: 找1的l,r,数出区间0的个数 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define ll long long 4 #define il inline 5 #define ...
分类:
其他好文 时间:
2020-02-13 09:31:39
阅读次数:
47
A. 从集合角度考虑式子的意义,就是选第一个数作为全集然后抠掉第二个数为1的位 连着做这个过程就是选一个数作为全集然后连着抠掉一些位 这样我们只要枚举第一个数就行了,前后缀加速一下这个过程 1 #include<bits/stdc++.h> 2 using namespace std; 3 int ...
分类:
其他好文 时间:
2020-02-10 11:44:18
阅读次数:
82
A. Array with Odd Sum 题目链接:https://codeforces.com/contest/1296/problem/A 题意: 你任意次将数组中的某个数改为另一个数,问你能否使数组中奇数的个数为奇数 分析: 不能为奇数的情况只有两种 ①、数组的所有元素皆为奇数且数组的长度为 ...
分类:
其他好文 时间:
2020-02-09 09:31:30
阅读次数:
82
There are nn monsters standing in a row numbered from 11 to nn . The ii -th monster has hihi health points (hp). You have your attack power equal to a ...
分类:
编程语言 时间:
2020-02-06 16:24:55
阅读次数:
146
地址:http://codeforces.com/contest/1291 A题就不写解析了,就是给一个数,是不是本身满足这个条件或者删除某些数字来达到这个条件:奇数,各个位上的数字加起来是偶数。 #include<iostream> #include<cstdio> #include<cstrin ...
分类:
其他好文 时间:
2020-02-05 23:24:19
阅读次数:
74
"E2. String Coloring (hard version)" 首先我们要明确一点,最多只会出现26种颜色,因为当下字母 如果在后面 出现过,那么在 i 这个位置的最佳颜色选择即为先前确定的颜色。所以我们可以使用状态压缩来记录状态。 ...
分类:
其他好文 时间:
2020-02-05 20:01:25
阅读次数:
87