摘要:
为什么有人永远渴望旅行,或许就因为,巧合和温暖会在下一秒蜂拥而至吧。 一直想去旅游的天天决定在即将到来的五一假期中安排一场环游世界的旅行。为此,他已经提前查阅了很多资料,并准备画一张旅游路线图。天天先将所有可能会去的 nn 个旅游城市依次编号标记为 1,2,⋯,n1,2,⋯,n。如果从城市 AA 到 阅读全文
摘要:
Cao Cao made up a big army and was going to invade the whole South China. Yu Zhou was worried about it. He thought the only way to beat Cao Cao is to 阅读全文
摘要:
百度科技园内有nn个零食机,零食机之间通过n−1n−1条路相互连通。每个零食机都有一个值vv,表示为小度熊提供零食的价值。 由于零食被频繁的消耗和补充,零食机的价值vv会时常发生变化。小度熊只能从编号为0的零食机出发,并且每个零食机至多经过一次。另外,小度熊会对某个零食机的零食有所偏爱,要求路线上必 阅读全文
摘要:
There is a country with 𝑛n citizens. The 𝑖i-th of them initially has 𝑎𝑖ai money. The government strictly controls the wealth of its citizens. When 阅读全文
摘要:
#include #include #include #include #include #include using namespace std; typedef long long ll; const int maxn=100010; //字符串长度最大值 int nex[maxn],ex[maxn]; //ex数组即为extend数组 //预处理计算next数组 //void GE... 阅读全文
摘要:
扩展欧几里得能求出形如a*x+b*y=gcd(a,b)的通解x,y。 我们设 a1*x1+b1*y1=gcd(a,b) (1) a2*x2+b2*y2=gcd(a,b) (2) 并且a2=b1,b2=a1%b1=a1-(a1/b1*b1) 则(1)(2)相等可得a1*x2+b1*y1=b1*x2+[ 阅读全文
摘要:
Pavel is developing another game. To do that, he again needs functions available in a third-party library too famous to be called. There are mm functi 阅读全文
摘要:
You are given a tree that represents a hierarchy in a company, where the parent of node u is their direct manager. Each employee is assigned a project 阅读全文
摘要:
This problem is same as the previous one, but has larger constraints. It was a Sunday morning when the three friends Selena, Shiro and Katie decided t 阅读全文
摘要:
There are n lines l1,l2,…,ln on the 2D-plane. Staring at these lines, Calabash is wondering how many pairs of (i,j) that 1≤i<j≤n and li,lj share at le 阅读全文