Educational Codeforces Round 15 C 二分】的更多相关文章

C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line…
C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line…
A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the gi…
C. Cellular Network time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given n points on the straight line — the positions (x-coordinates) of the cities and m points on the same line…
A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the gi…
比赛链接:http://codeforces.com/contest/702 A. Maximum Increase A题求连续最长上升自序列. [暴力题] for一遍,前后比较就行了. #include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #include <vector> #include &…
https://codeforces.com/contest/1132/problem/D 二分 + 线段树(弃用结构体型线段树) 题意 有n台电脑,只有一个充电器,每台电脑一开始有a[i]电量,每秒消耗b[i]电量,充电器每秒可以给一台电脑充x电,假如有一台电脑在某一秒末电量<0,则会关机,问最小的x使得在k秒内没有任何电脑关机 题解 二分答案x,线段树维护区间[1,n]最小天数,枚举k天每天单点修改天数最小的点 代码 #include<bits/stdc++.h> #define M…
A. Maximum Increase time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given array consisting of n integers. Your task is to find the maximum length of an increasing subarray of the gi…
Cellular Network 题意: 给n个城市,m个加油站,要让m个加油站都覆盖n个城市,求最小的加油范围r是多少. 题解: 枚举每个城市,二分查找最近的加油站,每次更新答案即可,注意二分的时候不要越界oil数组,上下界都不要越.还有,int坑死人,以后绝对全用long long!!! 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF=0x3f3f3f3f; cons…
Powers of Two 题意: 让求ai+aj=2的x次幂的数有几对,且i < j. 题解: 首先要知道,排完序对答案是没有影响的,比如样例7 1一对,和1 7一对是样的,所以就可以排序之后二分找2的x次幂相减的那个数就好了,注意:打表时2的x次幂不能只小于1e9,因为有可能是2个5e8相加,之后就超出了1e9,但是你打表的时候又没有超出1e9的那个2的x次幂,所以答案总是会少几个.所以尽量就开ll 能多打表就多打. 代码: #include <bits/stdc++.h> usin…