D2. Magic Powder - 2 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first l…
D1. Magic Powder - 1 题目连接: http://www.codeforces.com/contest/670/problem/D1 Description This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single soluti…
http://codeforces.com/problemset/problem/670/D2 http://codeforces.com/problemset/problem/670/D1 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The term of this problem is the same as the p…
题意:今天我们要来造房子.造这个房子需要n种原料,每造一个房子需要第i种原料ai个.现在你有第i种原料bi个.此外,你还有一种特殊的原料k个, 每个特殊原料可以当作任意一个其它原料使用.那么问题来了,你最多可以造多少个房子呢? 析:首先可以先把开始能造出的先处理出来,然后再进行二分,当然也可以直接进行二分. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #inc…
题目:http://codeforces.com/contest/1169/problem/C 题意: 有n个数,每次可以选择k个,将他们+1并对m取模.问最少进行多少次操作,使得序列是非递减的. 思路: 太久没刷题遭报应了.这两天能补多少是多少吧. 二分答案.然后看看这个序列是不是非递减的. 对于第i个数,如果$a[i]\leq prev\leq a[i]+mid$,说明在mid次操作内他肯定比他前一个数要大. 当然因为取模 所以实际上还应该包括$a[i]\leq prev+m\leq a[i…
C. Cinema time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scient…
D2. Magic Powder - 2 The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first line contains two positive integers n and k (1 ≤ n ≤ 100 000, 1 ≤ k ≤ 109) — the number of ingredients and the…
D2. Magic Powder - 2 time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The term of this problem is the same as the previous one, the only exception — increased restrictions. Input The first l…
D1. Magic Powder - 1 time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output This problem is given in two versions that differ only by constraints. If you can solve this problem in large constr…
题目链接:http://codeforces.com/contest/670/problem/D2 This problem is given in two versions that differ only by constraints. If you can solve this problem in large constraints, then you can just write a single solution to the both versions. If you find t…