http://codeforces.com/contest/1199/problem/D Examples input1 output1 input2 output2 Note In the first example the balances change as follows: 1 2 3 4 → 3 3 3 4 → 3 2 3 4 → 3 2 3 4 In the second example the balances change as follows: 3 50 2 1 10 → 3…
Preface 闲来无事打打CF,就近找了场Div1打打 这场感觉偏简单,比赛时艹穿的人都不少,也没有3000+的题 两三个小时就搞完了吧(F用随机水过去了) A. MP3 题意不好理解,没用翻译看了好久然后就看错了,后来发现是个SB题 考虑我们将数字排序+离散化之后就可以知道一个区间外有多少个数,可以直接计算答案 然后发现这个区间的移动有单调性,因此直接two points扫一下就好了 #include<cstdio> #include<cmath> #include<io…
比赛链接:https://codeforc.es/contest/1199 A. City Day 题意:给出一个数列,和俩个整数\(x,y\),要求找到序号最靠前的数字\(d\),使得\(d\)满足\(a_d<a_j\) (\(d-x\leq j<d\) && \(d<j\leq d+y\)). 分析:由于x和y都小于7,所以直接暴力即可. AC代码: #include <bits/stdc++.h> #define SIZE 200007 #define…
Div2 A 长度为\(n(n≤10^5)\)的数组,每个元素不同,求有多少个位置\(d\)满足\(d - x \le j < d \And d < j \le d + y a_d<a_j(0\le x,y\le 7)\) \(x,y\)较小,遍历每个位置,暴力判断即可 B 如下图,给出\(L,H\),求水面深度 设水面深度为\(x\),勾股定理:\(x^2+L^2=(x+H)^2\),解得\(x=\frac{L^2-H^2}{2H}\) Div1 A 长度为\(n(1 \le n \l…
1198 C Matching vs Independent Set 大意: 给定$3n$个点的无向图, 求构造$n$条边的匹配, 或$n$个点的独立集. 假设已经构造出$x$条边的匹配, 那么剩余$3n-2x$个点, 若$x<n$, 则$3n-2x\ge n$可以构造出独立集. #include <iostream> #include <sstream> #include <algorithm> #include <cstdio> #include…
C. MP3 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One common way of digitalizing sound is to record sound intensity at particular time moments. For each time moment intensity is record…
A. Sereja and Dima time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sereja and Dima play a game. The rules of the game are very simple. The players have n cards in a row. Each card contains…
题目链接:Codeforces Round #298 (Div. 2) A. Exam An exam for n students will take place in a long and narrow room, so the students will sit in a line in some order. The teacher suspects that students with adjacent numbers (i and i + 1) always studied side…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…