AtCoder Grand Contest 002 DEF AGC002D - Stamp Rally多次询问,整体二分。具体一些,当前二分的区间为 l,rl,r,先设定答案为 midmid,判断是否可行,可行的往 [l,mid][l,mid] 递归,否则走 [mid+1,r][mid+1,r]。关键在于如何快速判定是否可行。用并查集维护连通块的大小,一种办法使用可回退
【刷题】AtCoder Regular Contest 002 A.うるう年题意:判断闰年做法:。。#include<bits/stdc++.h> #define ui unsigned int #define ll long long #define db double #define ld long double #define ull unsigned long long #define REP(a,b,c) for(register int a=(b),a##end=(c);a<=a##end...
题目传送门 - AGC002F题意 给定$n,k$ ,表示有 $n\times k$ 个球,其中,颜色为 $1,2,\cdots, n$ 的球各有 $k$ 个。 将这些球任意排列成一排,对于每一种颜色,将这种颜色的球的最左边的那个涂成颜色 $0$ 。 问最终可以得到多少种不同的排列。 $1\leq n,k\leq 2000,{\rm Mo...
On this graph, Q pairs of brothers are participating in an activity called Stamp Rally. The Stamp Rally for the i-th pair will be as follows: One brother starts from vertex xi, and the other starts from vertex yi. The two explore the graph along the edges to visit zi vertices in tota...
typical90 015 - Don't be too close(★6) 二項係数 atc002 B - n^p mod m 繰返し二乗法 abc167 E - Colorful Blocks 二項係数 abc021 D - 多重ループ 二項係数 agc025 B - RGB Coloring 二項係数, 素因数分解 arc077 D - 11 二項係数 arc116 C - Multiple Sequences 二項係数, 素...
原文链接https://www.cnblogs.com/zhouzhendong/p/AGC002F.html 题目传送门 - AGC002F 题意 给定 $n,k$ ,表示有 $n\times k$ 个球,其中,颜色为 $1,2,\cdots, n$ 的球各有 $k$ 个。 将这些球任意排列成一排
Choose a pile with the largest number of candies remaining, then eat all candies of that pile. From each pile with one or more candies remaining, eat one candy. The player who eats the last candy on the table, loses the game. Determine which player will win if both players play the ga...
AtCoder Grand Contest 002 C - Knot Puzzle 逆向思维,从后往前考虑,发现最终的局面必定是两个加起来大于\(L\)的相邻元素,只要寻找并判断这个位置是否存在即可。 int n, a[N], L; inline void solve() { Rdn(n, L); forn(i,1,n) Rdn(a[i]);...
N L a1 a2 … an 输出 If it is not possible to untie all of the N−1 knots, print Impossible. 样例输入 3 50 样例输出 Possible 提示 If the knot 1 is untied first, the knot 2 will become impossible to untie. 题目大意是给你n根绳子通过打结的方式首尾相接成一根绳子,要你解开这个绳子上...
AtCoder Grand Contest 002 AtCoder Grand Contest 002A - Range Product翻译告诉你a,ba,b,求∏bi=ai∏i=abi是正数还是负数还是零。题解什么鬼玩意。#include<iostream> using namespace std; int main() { int a,b; cin>>a>>b; if(a<=0&&b>=0)cout<<"Zero"<<endl; else { if(a>0)cout<<...