D - Ki 题意:给一棵有根树,节点1为根,有$Q$次操作,每次操作将一个节点及其子树的所有节点的权值加上一个值,问最后每个节点的权值. 思路:dfs序再差分一下就行了. #include <bits/stdc++.h> using namespace std; ; vector<int> G[N]; int dfn[N], id, n, q, last[N], pos[N]; long long val[N], ans[N]; void dfs(int u, int fa) {…
A - Grouping 2 Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement There are N students in a school. We will divide these students into some groups, and in each group they will discuss some themes. You think that groups cons…
从这里开始 比赛目录 A < B < E < D < C = F,心情简单.jpg. Problem A >< 把峰谷都设成 0. Code #include <bits/stdc++.h> using namespace std; typedef bool boolean; const int N = 5e5 + 5; int n; char s[N]; int L[N], R[N]; int main() { scanf("%s",…
从这里开始 题目目录 Problem A XOR Circle 你发现,权值的循环节为 $a_0, a_1, a_0\oplus a_1$,然后暴力即可. Code #include <bits/stdc++.h> using namespace std; typedef bool boolean; const int N = 1e5 + 5; int n; int a[N], b[N]; void quitif(boolean condition, const char* vert = &q…
从这里开始 比赛目录 Problem A Triangle 考虑把三角形移到和坐标轴相交,即 然后能够用坐标比较简单地计算面积,简单构造一下就行了. Code #include <bits/stdc++.h> using namespace std; typedef bool bolean; #define ll long long const int V = 1e9; ll S; int main() { scanf("%lld", &S); if (S == 1…