Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is a lamp in a block, it will light it’s block and the direct adjacent blocks. For example, if there is a lamp at block 3, it will light the blocks 2, 3…
codeforce 375_2 标签: 水题 好久没有打代码,竟然一场比赛两次卡在边界条件上....跪 b.题意很简单...纯模拟就可以了,开始忘记了当字符串结束的时候也要更新两个值,所以就错了 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int N = 300; char a[N]; int main() { int n; int l; int su…
GANs and Divergence Minimization 2018-12-22 09:38:27 This blog is copied from: https://colinraffel.com/blog/gans-and-divergence-minimization.html This post discusses a perspective on GANs which is not new but I think is often overlooked. I'l…
F. Yet Another Minimization Problem http://codeforces.com/contest/868/problem/F 题意: 给定一个长度为n的序列.你需要将它分为m段,每一段的代价为这一段内相同的数的对数,最小化代价总和. n<=100000,m<=20. 分析: f[k][j]=min{f[k-1][j]+cost(k,j,i)}; cost发现不能快速的算出.于是不能用类似单调队列+二分的方法来做了. 考虑分治,solve(Head,Tail,L…
codeforce 7C C. Line time limit per test1 second memory limit per test256 megabytes A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers from - 5·1018 to 5·101…
D. Minimization time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You've got array A, consisting of n integers and a positive integer k. Array A is indexed by integers from 1 to n. You…
B. Minimization time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You've got array A, consisting of n integers and a positive integer k. Array A is indexed by integers from 1 to n. You need…
An arithmetic progression is such a non-empty sequence of numbers where the difference between any two successive numbers is constant. This constant number is called common difference. For example, the sequence 3, 7, 11, 15 is an arithmetic progressi…
You are given a sequence of numbers a1, a2, ..., an, and a number m. Check if it is possible to choose a non-empty subsequence aij such that the sum of numbers in this subsequence is divisible by m. Input The first line contains two numbers, n and m…
In the capital city of Berland, Bertown, demonstrations are against the recent election of the King of Berland. Berland opposition, led by Mr. Ovalny, believes that the elections were not fair enough and wants to organize a demonstration at one of th…
Two players play a game. The game is played on a rectangular board with n × m squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same square. The second player…
To confuse the opponents, the Galactic Empire represents fractions in an unusual format. The fractions are represented as two sets of integers. The product of numbers from the first set gives the fraction numerator, the product of numbers from the se…