P1099 树网的核 已知i到j是一条路径,求k到这条路径的距离 \(ans = (dis[i][k] + dis[i][k] - dis[i][j] ) / 2\) 乱搞 300数据乱搞之——最短路求解直径 300数据乱搞之——n^3的最短路求法 求 n的唯一路径求法 300数据乱搞之——n^2枚 ...
分类:
其他好文 时间:
2020-09-09 19:04:53
阅读次数:
33
二分答案,设$s_{i,j}$表示第$i$天对竹子$j$的操作次数,$h_{i,j}$表示第$i$天结束时竹子$j$的高度,则$h_{i,j}=\max(h_{i-1,j}-ps_{i,j},0)+a_{j}$,合法当且仅当$h_{0,i}=h_{i}$且$h_{m,i}\le ans$ 令$h'_ ...
分类:
其他好文 时间:
2020-09-03 17:08:46
阅读次数:
58
class Solution { List<Integer> temp = new ArrayList<Integer>(); List<List<Integer>> ans = new ArrayList<List<Integer>>(); public List<List<Integer>> f ...
分类:
其他好文 时间:
2020-09-03 16:59:05
阅读次数:
46
分两部分 一、7 -> 10 例如:(3051)7 = ( ? )10,待会用ans表示10进制结果 ①把3051的各个位上的数分解出来,分解成:3、0、5、1 ②ans = 0*7+3 = 3 ans = 3(上一轮的ans值)*7+0 = 21 ans = 21*7 + 5 = 152 ans ...
分类:
其他好文 时间:
2020-08-08 17:46:22
阅读次数:
69
#include<bits/stdc++.h> using namespace std; const int maxn=200005; struct node{ int a; int b; int c; int cnt; int ans; }s1[maxn],s2[maxn]; int n,m,k, ...
分类:
其他好文 时间:
2020-08-03 09:51:54
阅读次数:
74
题目链接:https://codeforc.es/contest/1388/problem/D 题意:一种操作为 选一个下标 使得ans+=a[i] 且 把a[i]+到a[b[i]]中 要求每个下标都进行一种这样的操作,问怎么样的操作顺序才能使得ans最大 思路:要使得ans最大,那么肯定是a[i] ...
分类:
其他好文 时间:
2020-08-02 22:19:04
阅读次数:
108
题目 交互题 给出长度为$n$的单调不减序列,一次询问可以询问$[l,r]$中的众数$x$(如果多个数字出现次数相同则返回最小的数字)以及$x$出现的次数$f$ 设$n$中不同数字的个数为$k$,询问次数不得超过$4k$ ,输出整个的序列 $1 \le n \le 2\times 10^5 \ , ...
分类:
其他好文 时间:
2020-07-30 22:16:14
阅读次数:
75
题目描述 输入一个整数,输出该数32位二进制表示中1的个数。其中负数用补码表示。 思路1:常规解法,位运算 1 class Solution { 2 public: 3 int NumberOf1(int n) { 4 int ans=0; 5 int index=1; 6 while (index ...
分类:
其他好文 时间:
2020-07-30 14:53:41
阅读次数:
85
class Solution { int f[505][505]; public: int maxDotProduct(vector<int>& nums1, vector<int>& nums2) { int m=nums1.size(),n=nums2.size(); int ans=-1e9; ...
分类:
其他好文 时间:
2020-07-30 14:38:05
阅读次数:
55
#include <bits/stdc++.h> #define MAXN 200005 using namespace std; int node,edge,ans=0,k=0; int fat[MAXN],siz[MAXN]; struct EDGE { int from,to,cost; } ...
分类:
编程语言 时间:
2020-07-30 01:20:30
阅读次数:
71