Summer holidays! Someone is going on trips, someone is visiting grandparents, but someone is trying to get a part-time job. This summer Noora decided that she wants to earn some money, and took a job in a shop as an assistant. Shop, where Noora is wo…
---恢复内容开始--- 题目: Once upon a time, in the Kingdom of Loowater, a minor nuisance turned into a major problem. The shores of Rellau Creek in central Loowater had always been a prime breeding ground for geese. Due to the lack of predators, the geese pop…
丽娃河的狼人传说 Time limit per test: 1.0 seconds Time limit all tests: 1.0 seconds Memory limit: megabytes 丽娃河是华师大著名的风景线.但由于学校财政紧缺,丽娃河边的路灯年久失修,一到晚上就会出现走在河边要打着手电的情况,不仅非常不方便,而且影响安全:已经发生了大大小小的事故多起. 方便起见,丽娃河可以看成是从 到 n 的一条数轴.为了美观,路灯只能安装在整数点上,每个整数点只能安装一盏路灯.经专业勘测,…
#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<string> #include<cmath> #include<map> #include<set> #include<vector> #include<algorithm> #include<stack> #in…
题目描述: C. Elections time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As you know, majority of students and teachers of Summer Informatics School live in Berland for the most part of the year…
原题链接:http://codeforces.com/contest/830/problem/A 题意:在一条数轴上分别有n个人和k把钥匙(n<=k),以及一个目的地,每个人要各自拿到一个钥匙后到达目的地.每个人的移动速度都是1, 问所有人都到达目的地的最短时间. 思路:转化一下题意,就是求耗时最长的人所用的最短时间. 我们可以二分答案x,然后对排序后的人以及钥匙进行枚举,进行从左至右搭配. 这里check函数中返回false的条件是从左至右所有人都能在x的时间内到达目的地,而计算这些人到达目的…
题目链接: A. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Student Valera is an undergraduate student at the University. His end of term exams are approaching and he is to pass exactly …
题目链接 题意 给定序列,$q(1\leq q \leq 100000) $次询问,每次查询给定区间内的最大异或子集. 思路 涉及到最大异或子集肯定从线性基角度入手.将询问按右端点排序后离线处理询问,对线性基的每一位贪心的保留靠后的. 代码 #include <bits/stdc++.h> #define DBG(x) cerr << #x << " = " << x << endl; using namespace std;…
题意 https://vjudge.net/problem/CodeForces-1253C n个糖果,一天最多吃m个糖果,每个糖果有个值a[i],第d天会变成d*a[i],问吃k(k=1~n)个糖果权值和的最小值分别是多少. 思路 先排序,再求一遍前缀和. 比如m=2,排序后:2 3 4 4 6 6 7,那么ans[1]=2,ans[2]=5:对于k=3,贪心的想法肯定是把大的两个第一天吃,小的第二天吃,ans[3]=11:对于k,肯定是把最大的m个第一天吃,剩下的可以通过ans[k-m]得到…
给定一个整数n,给定一个整数m,将1~n个整数按字典顺序进行排序,返回排序后第m个元素.n最大可为5000000.字典排序的含义为:从最高位开始比较.1开头的数字排在最前面,然后是2开头的数字,然后是3开头的数字……最高位相同的数字,按同样的逻辑比较次高位……以此类推.例:给定整数为n=13,m=5,那么字典排序结果为: [1,10,11,12,13,2,3,4,5,6,7,8,9] ,程序最终输出为13. 输入:m, n 输出:第m个数 #include<iostream> #include…