E. Connected Component on a Chessboard time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given two integers b and w. You have a chessboard of size 109×109 with the top left cell at (1;1)…
传送门 题意: 给你一个黑白相间的1e9*1e9的棋盘,你需要从里面找出来由b个黑色的格子和w个白色的格子组成的连通器(就是你找出来的b+w个格子要连接在一起,不需要成环).问你可不可以找出来,如果可以就先打印YES,再打印出所有格子的坐标,否则打印出NO. 题解: 参考博客 如果b和w相等的时候,那么就可以用棋盘的一行来表示. 对于不相等的情况: 如果max(w,b)>min(w,b)*3+1那么这样是找出不来符合条件的连通区域的. 看图中的红色部分你会知道只有这样十十的连接起来才是最大构成情…
Codeforces Round #575 (Div. 3) 这个div3打的太差了,心态都崩了. B. Odd Sum Segments B 题我就想了很久,这个题目我是找的奇数的个数,因为奇数想分成x个奇数,那么这个x肯定是一个奇数, 偶数同理,如果一个偶数想分成y个奇数,那么这个y肯定是一个偶数. 所以数奇数的个数,如果奇数有x个,x是偶数,那么k一定是一个偶数,如果x是一个奇数,那么k肯定是一个奇数. 输出也比较简单,因为奇数要分成奇数个,所以可以前面每组都是含有一个奇数,最后肯定会有奇…
比赛链接:https://codeforc.es/contest/1196 A. Three Piles of Candies 题意:两个人分三堆糖果,两个人先各拿一堆,然后剩下一堆随意分配,使两个人中最后糖果较少的那个人的糖果最多. 分析:水题. AC代码: #include <bits/stdc++.h> #define SIZE 300007 #define rep(i, a, b) for(int i = a; i <= b; ++i) typedef long long ll;…
本蒟蒻已经掉到灰名了(菜到落泪),希望这次打完能重回绿名吧...... 这次赛中A了三题 下面是本蒟蒻的题解 A.Three Piles of Candies 这题没啥好说的,相加除2就完事了 #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll q; scanf("%lld",&q); while(q--) { ll a,b,c; scanf("…
D2. RGB Substring (hard version) inputstandard input outputstandard output The only difference between easy and hard versions is the size of the input. You are given a string…
D1. RGB Substring (easy version) time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The only difference between easy and hard versions is the size of the input. You are given a string s consistin…
C. Robot Breakout time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output n robots have escaped from your laboratory! You have to find them as soon as possible, because these robots are experimental,…
B. Odd Sum Segments time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given an array a consisting of n integers a1,a2,-,an. You want to split it into exactly k non-empty non-intersecting…
A. Three Piles of Candies time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Alice and Bob have received three big piles of candies as a gift. Now they want to divide these candies as fair as poss…