There is a robot on a coordinate plane. Initially, the robot is located at the point (0,0)(0,0) . Its path is described as a string ss of length nn consisting of characters 'L', 'R', 'U', 'D'. Each of these characters corresponds to some move: 'L' (l…
There are nn monsters standing in a row numbered from 11 to nn . The ii -th monster has hihi health points (hp). You have your attack power equal to aa hp and your opponent has his attack power equal to bb hp. You and your opponent are fighting these…
Mishka wants to buy some food in the nearby shop. Initially, he has ss burles on his card. Mishka can perform the following operation any number of times (possibly, zero): choose some positive integer number 1≤x≤s1≤x≤s , buy food that costs exactly x…
链接: https://codeforces.com/contest/1272/problem/B 题意: Recently you have bought a snow walking robot and brought it home. Suppose your home is a cell (0,0) on an infinite grid. You also have the sequence of instructions of this robot. It is written as…
1296A - Array with Odd Sum 题意:可以改变数组中的一个数的值成另外一个数组中的数,问能不能使数组的和是个奇数 思路:签到,如果本来数组的和就是个奇数,那就OK 如果不是,就需要把数组中其中一个奇(偶)数改成偶(奇)数,相当于加一减一 所以测一下这个数组如果有个奇数并且还有个偶数就行 #include <cstdio> #include <iostream> #include <map> #include <set> #include…
又是隔了一年才来补题的我 A.B水题就不用说了 C - Yet Another Walking Robot C题我居然卡了一会,最后决定用map水,结果出来看了看题解,居然真的是map...没想到会出这样题解用stl的方法,是我失策了 #include <cstdio> #include <algorithm> #include <map> using namespace std; * ; char s[N]; typedef pair <int, int>…
A. Array with Odd Sum Description You are given an array \(a\) consisting of \(n\) integers. In one move, you can choose two indices \(1 \le i, j \le n\) such that \(i \ne j\) and set \(a_i := a_j\). You can perform such moves any number of times (po…
C. Yet Another Walking Robot time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There is a robot on a coordinate plane. Initially, the robot is located at the point (0,0)(0,0). Its path is des…
Codeforces #344 Div.2 Interview 题目描述:求两个序列的子序列或操作的和的最大值 solution 签到题 时间复杂度:\(O(n^2)\) Print Check 题目描述:有一个棋盘,对其进行染色,每次染一行或一列,后来的颜色会覆盖原来的颜色,输出最后的棋盘. solution 题解用二维线段树,其实可以不用. 对染色进行离线操作,那么染过的格子.行.列就不用再染了.所以每个格子可以记录四个指针,分别是行前驱,行后继,列前驱列后继,染色时按照这个跳着来染就好了.…
Codeforces #345 Div.1 打CF有助于提高做题的正确率. Watchmen 题目描述:求欧拉距离等于曼哈顿距离的点对个数. solution 签到题,其实就是求有多少对点在同一行或同一列. 时间复杂度:\(O(nlogn)\) Image Preview 题目描述:给定看一张照片的时间,翻页的时间,把图片翻转的时间.一开始屏幕显示第一张照片,可以向左或向右翻,不能跳过还没有看过的图片,方向不对的图片要先翻转再看,看过的不消耗翻转时间与看照片时间,问在一定时间内,最多能看多少张照…