上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 31 下一页
摘要: A-教科书般的亵渎 #include <bits/stdc++.h> using namespace std; #define int long long using vi = vector<int>; using pii = pair<int, int>; using i32 = int32_t; 阅读全文
posted @ 2023-10-17 15:06 PHarr 阅读(31) 评论(0) 推荐(0) 编辑
摘要: A. A Hero Named Magnus #include <bits/stdc++.h> using namespace std; #define int long long using pii = pair<int, int>; using vi = vector<int>; void so 阅读全文
posted @ 2023-10-13 16:48 PHarr 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 割点和桥的概念都是在无向图中 给定无向连通图\(G\in(V,E)\) 若对于\(x\in V\),从图中删除节点\(x\)以及所有\(x\)链接的边后,\(G\)分裂成两个或两个以上个不相连的子图,则称\(x\)为\(G\)的割点 割点判定法则 若\(x\)不是搜索树的根节点,则\(x\)是割点当 阅读全文
posted @ 2023-10-11 16:41 PHarr 阅读(32) 评论(0) 推荐(0) 编辑
摘要: A. Yes-Yes? #include <bits/stdc++.h> using namespace std; #define int long long using pii = pair<int, int>; using vi = vector<int>; const string T = " 阅读全文
posted @ 2023-10-10 16:56 PHarr 阅读(8) 评论(0) 推荐(0) 编辑
摘要: The 1st Universal Cup. Stage 8: Slovenia D. Deforestation 这道题出题人比较谜语人,对于一个分叉点,只能选择若干个儿子和父亲组成一组,剩下的儿子之间不能相互组合。所以从叶子节点开始贪心处理就好。对于一个父亲他有若干个儿子,就贪心的选择剩下部分更 阅读全文
posted @ 2023-10-06 16:35 PHarr 阅读(116) 评论(0) 推荐(0) 编辑
摘要: A. So I'll Max Out My Constructive Algorithm Skills 首先一行正一行反的把所有的行拼到一起,然后判断一下正着走时候合法不合法就反过来走就好。 #include <bits/stdc++.h> using namespace std; #define 阅读全文
posted @ 2023-10-06 14:29 PHarr 阅读(26) 评论(1) 推荐(0) 编辑
摘要: A. Tower 首先用了 dp 验证出把一个数字变成另一个数字的最优解一定是能除就先进行除法,然后再使用加一减一。 这样我们就有\(O(\log n)\)的复杂度求出把一个数变成另一个数的最小代价。 然后就是猜测最终的目标一定是某个数除了若干次二得到的。所以就枚举一下目标即可。 #include 阅读全文
posted @ 2023-10-06 14:04 PHarr 阅读(83) 评论(0) 推荐(0) 编辑
摘要: C. Clamped Sequence 因为\(n\)的范围不大,并且可以猜到\(l,r\)中应该至少有一个在\(a_i,a_i-1,a_i+1\)上。所以直接暴力枚举\(l\)或\(r\)然后暴力的计算一下 #include <bits/stdc++.h> using namespace std; 阅读全文
posted @ 2023-10-01 19:10 PHarr 阅读(120) 评论(0) 推荐(1) 编辑
摘要: A. Everyone Loves to Sleep #include<bits/stdc++.h> using namespace std; void solve() { int n, h, m, t; cin >> n >> h >> m; t = h * 60 + m; vector<int> 阅读全文
posted @ 2023-10-01 18:15 PHarr 阅读(9) 评论(0) 推荐(0) 编辑
摘要: A. Div. 7 #include<bits/stdc++.h> using namespace std; void solve(){ int n , a , b , c ; cin >> n; c = n % 10 , n /= 10; b = n % 10 , n /= 10; a = n % 阅读全文
posted @ 2023-09-30 12:36 PHarr 阅读(7) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 31 下一页