先跑spfa求出最短路构成的DAG,然后在DAG上跑出支配树dfs出size取max即可 关于支配树,因为是DAG,支配点就是入点在支配树上的lca,所以一边拓扑一边预处理倍增,然后用倍增求lca #include<iostream> #include<cstdio> #include<cstring> #include<queue> #include<vector> using namespace
题目链接:HDU 1702 ACboy needs your help again! 啥错都范,return 0; 忘写了。。。 #include<iostream> #include<cstdio> #include<stack> #include<queue> using namespace std; int main() { int t,n,m; cin>>t; string s,com; queue<int> q
正解:博弈论 解题报告: 传送门! 首先按照套路显然是考虑先预处理出所有数的$SG$函数值然后全局的$SG$就是$SG(n)$^$SG(m)$^$SG(p)$,这儿应该麻油问题$QwQ$? 然后就考虑怎么求$SG$函数?于是就直接$SG(x)=mex\{SG(x-y),y\in Fib,x\ge y\}$就好鸭$QwQ$ $over$,然后代码也许咕了也许周
After a terrifying forest fire in Berland a forest rebirth program was carried out. Due to it N rows with M trees each were planted and the rows were so neat that one could map it on a system of coordinates so that the j-th tree in the i-th row would hav
原文: He is awful。 A:What's Ron Marston like , Pauline? B:He is awful.He telephoned me four times yesterday,and three times the day before yesterday. B:He telephoned the office yesterday morning and yesterday afternoon.My boss answered the telephone. A
Problem Description There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2). Input Input consists of a sequence of lines, each containing an integer n. (n < 1,000,000). Output Print the word "yes" if
问题:编译时错误:A JNI error has occurred, please check your installation and try again 分析:重复安装了SDK,电脑中存在不同版本SDK 解决:①命令行中通过“java -version”和“javac -version”查询SDK版本 ②把不需要的版本删除掉(在控制面板卸载)
https://pintia.cn/problem-sets/994805342720868352/problems/994805380754817024 An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 39021 Accepted Submission(s): 15794 Problem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal
A + B for you again Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9765 Accepted Submission(s): 2410 Problem Description Generally speaking, there are a lot of problems about strings processing. Now y
好懒again,草稿 用时4ms,内存1M (好高啊魂淡 class Solution { public: string removeDuplicateLetters(string s) { auto length=s.size(); if (length<=1) return s; int counts[26]={0}; for (int i=0;i<length;i++)