n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point with non-n
You are given two arrays of integers a and b. For each element of the second arraybj you should find the number of elements in array a that are less than or equal to the value bj. Input The first line contains two integers n, m (1 ≤ n, m ≤ 2·105) — t
题目: B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have two friends. You want to present each of them several positive integers. You want to present cnt1 number
题意:给一个 s 串和 t 串, s 串中有若干问号,问如何填充问号使得 s 串中字母可以组成最多的 t 串.输出填充后的 s 串. 思路:想了下感觉直接怼有点麻烦,要分情况:先处理已经可以组成 t 串的部分,然后处理 s 串中可以利用的部分,如果还有问号剩余,再直接怼.但如果用二分写就很直观了,直接看最多能组成多少个 t 串. 居然踩了long long的坑感觉自己宛若一个zz.check函数中的计算要用long long防止溢出= =(明明大水题的说. #include<iostream>
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> #include<cmath> using namespace std; const int maxn = 1000010; int value[maxn]; int money[maxn]; int n,m; int main() { scanf(&qu
题目链接:http://codeforces.com/contest/732/problem/D 题意:有m门需要过的课程,n天的时间可以选择复习.考试(如果的d[i]为0则只能复习),一门课至少要复习a[i]天才能通过,问最早什么时候可以把所有课程都通过,如果不能输出-1. 思路:二分判断,比赛时不会check...具体见注释. #include<bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n,m,d[N],a