摘要:利用树上DSU来统计每一个点的答案 #include<bits/stdc++.h> #define forn(i, s, t) for (int i = s ; i < (int)t ; i++) #define fi first #define se second #define all(x) x
阅读全文
摘要:很像二维偏序,我们把武器和怪物放在一起排序按照攻击力递增的顺序,顺序扫描,这样攻击力满足了要求,然后防御力可以用一个线段树来处理,具体看代码 #include<iostream> #include<cstdio> #include<cstring> #include<vector> #include
阅读全文
摘要:集合的大小不会超过三 #include<bits/stdc++.h> #define forn(i, n) for (int i = 0 ; i < int(n) ; i++) #define fore(i, s, t) for (int i = s ; i < (int)t ; i++) #def
阅读全文
摘要:#include<bits/stdc++.h> #define forn(i, n) for (int i = 0 ; i < int(n) ; i++) #define fore(i, s, t) for (int i = s ; i < (int)t ; i++) #define fi firs
阅读全文
摘要:#include<bits/stdc++.h> #define forn(i, n) for (int i = 0 ; i < int(n) ; i++) #define fore(i, s, t) for (int i = s ; i < (int)t ; i++) #define fi firs
阅读全文
摘要:题解: 首先我们转化下思维,题目上说用1 5 10 50 ,我们选择用0 4 9 49,这样我们只需要去考虑序列中4 9 49 的个数就可以了 这道题的难点在于一个数可能会有多种表示方法,为了避免重复,我们表示每一个数的时候应该用唯一的方式去表示他 因此对于一个数,我们先尽量去用49凑,再用9去凑,
阅读全文
摘要:每一个数都是 p*q p^2 p^3 p^4 的形式,分类讨论即可 #include<bits/stdc++.h> #define forn(i, n) for (int i = 0 ; i < int(n) ; i++) #define fore(i, s, t) for (int i = s ;
阅读全文
摘要:#include<bits/stdc++.h> #define forn(i, n) for (int i = 0 ; i < int(n) ; i++) #define fore(i, s, t) for (int i = s ; i < (int)t ; i++) #define fi firs
阅读全文
摘要:#include<bits/stdc++.h> #define forn(i, n) for (int i = 0 ; i < int(n) ; i++) #define fore(i, s, t) for (int i = s ; i < (int)t ; i++) #define fi firs
阅读全文
摘要:题解:起点位置固定,枚举终点即可 #include<bits/stdc++.h> #define forn(i, n) for (int i = 0 ; i < int(n) ; i++) #define fore(i, s, t) for (int i = s ; i < (int)t ; i++
阅读全文
摘要:题意简述:给出N个点,任意两点之间有一条直线,问共有多少对直线相交?(N<=2000) 官方代码如下 #include <cstdio> #include <map> #include <set> #include <utility> const int N = 1001; int x[N], y[
阅读全文