https://atcoder.jp/contests/abc187/tasks/abc187_e 2|0题意 给你一棵nn个节点的树,一开始节点权值都为00,N−1N−1条边,每条边连接a[i]−b[i]a[i]−b[i],俩种操作: 1.以a[i]a[i]为起点遍历所有的点且路径上不能经过b[i]b[i],路径上的所有点加ww. 2.以b[i]b[i]为起点遍历...
a,n) for(int i=a;i<=n;++i) #define per(i,n,a) for(int i=n;i>=a;--i) #define endl '\n' #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; typedef long long ll; typedef pair<ll,ll> PII; const int maxn = 2e5+200; ...
E - Through Path 题意 现有一颗树,有\(n\)个结点和\(n-1\)条边,每个结点初始值为\(0\),现有\(q\)次询问,当\(t=1\)时,每个能够从\(a_{e_i}\)不经过\(b_{e_i}\)访问到的结点的值增加\(x\)。当\(t=2\)时,每个能够从\(b_{e_i}\)不经过\(a_{e_i}\)访问到的结点的...
时间复杂度\(\mathcal{O}(N^2)\)。 int main() { ios_base::sync_with_stdio(false), cin.tie(0); int n; cin >> n; int x[1010], y[1010]; int cnt = 0; for (int i = 0; i < n; ++i) { cin >> x[i] >> y[i]; } for (int i = 0; i < n; ++i) for (int ...
·AtCoder Beginner Contest (ABC) 这是最频繁且最简单的入门赛,通常情况下每月至少举行2次。2019年4月27日(含)之前,每场比赛共4题,时长100分钟,满分1000分且Rating超过1199的选手不计Rating值。自2019年5月19日起改版升级为6道题目,时长不变,满分2100分且Rating值超过1999的选手不计Rating值。改版之后比赛质量...
头一次写题解。 A - A Healthy Breakfast r在m前面输出Yes,反之输出No。 统计两个位置比一下就行。 voidsolve(){strings;cin>>s;inta=0,b=0;for(inti=0;i<3;i++)if(s[i]=='R')a=i;elseif(s[i]=='M')b=i;if(a<b)yes;elseno;} ...
AtCoder Beginner Contest 402(A-F详细题解) A 思路:我们直接输出字符串中的大写字母即可。 代码:#include<bits/stdc++.h> using namespace std; #define int long long #define N 500010 signed main(){ string s;cin>>… 秋日薄雾 Atcoder Education DP Contest 很好的 Atcoder 的 DP ...
AtCoder Beginner Contest 185 (手速场) java 直接算C ( l − 1 , l − 12 )即可。由于题目中没有模数,偷懒使用了JAVA的大整数 dejavu1zz 2020/12/16 3230 AtCoder Beginner Contest 182 A~E 编程算法 B 题意:就是找到一个数能被尽可能多的a[]数组里面的数整除。找到这个数输出就行了。 因为只...
[AtCoder Beginner Contest 365](https://atcoder.jp/contests/abc365) 题解 ABC365的比赛题解,我做出G题了,但暂时不发,需要的请私信 私信前请看:https://www.luogu.com.cn/paste/lowgb1lx ### A - Leap Year [翻](https://blog.csdn.net/qianzhima2012/article/details/141070004?spm=1001.2014.3001....
E - Last Rook 简单二分 题意: 交互题,给定n*n的矩阵,要求每一行每一列都有一个棋子,目前已经放了n-1个棋子,请询问一个矩阵内的棋子数量,询问次数不超过1000,最后找到最后一个棋子应该存放的位置。 分析: 我们只需要二分两次,第一次二分目标点x的坐标,如果1,1到mid,n这个矩阵内的棋子数量为mid,说明x...