链接:https://www.nowcoder.com/acm/contest/143/J 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 There are n students going to travel. And hotel has two types room:double room and triple room. The price of a double
F-Partition problem https://ac.nowcoder.com/acm/contest/882/F 题意:输入一个数n,代表总共有2n个人,然后每个人对所有人有个贡献值,然后问题需要将2n个人分成两组,每组n个人,问如何分组使得两组之间的价值最大,同组人不算价值. 思路:直接dfs暴力分组. //aeha #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef unsi
链接:https://www.nowcoder.com/acm/contest/147/E 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Niuniu likes to play OSU! We simplify the game OSU to the following problem. Given n and m, there are n clicks. Each c
链接:https://www.nowcoder.com/acm/contest/145/J 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K Special Judge, 64bit IO Format: %lld 题目描述 You have a n * m grid of characters, where each character is an English letter (lowercase or uppercase, w
链接:https://www.nowcoder.com/acm/contest/145/C 来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld 题目描述 A binary string s of length N = 2n is given. You will perform the following operation n times : - Choos
链接:https://www.nowcoder.com/acm/contest/145/A 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld 题目描述 You have a complete bipartite graph where each part contains exactly n nodes, numbered from 0 to n - 1
传送门:https://ac.nowcoder.com/acm/contest/881/A 题意:给定两个数组a和b,求最大的p,满足在区间 [1,p] 中任何区间的两个数组的最小值的下标都相等. 思路:先用单调栈,跑出数组 a 和 b 中每个元素的左边第一个比他小的数的位置和右边第一个比他小的数的位置,左边的下标加1,右边的下标减1,那么就得到了每个数字的以这个数为区间的最小值的区间. 然后再对于两个数组的每个数字的区间去遍历.对于一个总长度为n的数组来说,从第一个去开始比较,如果这两个数的左
链接:https://www.nowcoder.com/acm/contest/105/H来源:牛客网 n个桶按顺序排列,我们用1~n给桶标号.有两种操作: 1 l r c 区间[l,r]中的每个桶中都放入一个颜色为c的球 (1≤l,r ≤n,l≤r,0≤c≤60) 2 l r 查询区间[l,r]的桶中有多少种不同颜色的球 (1≤l,r ≤n,l≤r) 输入描述: 有多组数据,对于每组数据:第一行有两个整数n,m(1≤n,m≤100000)接下来m行,代表m个操作,格式如题目所示.
链接:https://www.nowcoder.com/acm/contest/147/A 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Niuniu has recently learned how to use Gaussian elimination to solve systems of linear equations. Given n and a[i], wh
链接:https://ac.nowcoder.com/acm/contest/881/A来源:牛客网 题目描述 Two arrays u and v each with m distinct elements are called equivalent if and only if RMQ(u,l,r)=RMQ(v,l,r)RMQ(u,l,r)=RMQ(v,l,r) for all 1≤l≤r≤m1≤l≤r≤mwhere RMQ(w,l,r)RMQ(w,l,r) denotes the inde
链接:https://ac.nowcoder.com/acm/contest/881/A 来源:牛客网 Equivalent Prefixes 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld 题目描述 Two arrays u and v each with m distinct elements are called equivalent if and only if R M Q ( u ,
链接:https://ac.nowcoder.com/acm/contest/882/F来源:牛客网 Given 2N people, you need to assign each of them into either red team or white team such that each team consists of exactly N people and the total competitive value is maximized. Total competitive va
链接:https://ac.nowcoder.com/acm/contest/881/A来源:牛客网 Two arrays u and v each with m distinct elements are called equivalent if and only if RMQ(u,l,r)=RMQ(v,l,r)RMQ(u,l,r)=RMQ(v,l,r) for all 1≤l≤r≤m1≤l≤r≤m where RMQ(w,l,r)RMQ(w,l,r) denotes the index of
链接:https://ac.nowcoder.com/acm/contest/889/D来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 Amy asks Mr. B problem D. Please help Mr. B to solve the following problem. Amy wants to crack Merkle–Hellman knapsack
一.题意 我们是穿越银河的火箭队....... 给出若干个区间,之后给出若干个点,要求对每个点求出,第一个覆盖点的区间的数量,之后用当前所有点覆盖的区间的序号的乘积结合输入的Y来生成下一位点.最后输出,每个区间第一次覆盖的点的序号. There are n trains running between Kanto and Johto region. Assuming the railway is a number line, the i-th train travels from coordin
一.题意 给出你的N门课程的考试成绩和所占的机电数目.允许你放弃K门课的成绩,要求你的平均学分绩最高能达到多少. Kanade selected n courses in the university. The academic credit of the i-th course is s[i] and the score of the i-th course is c[i]. At the university where she attended, the final score of he
一.题意 White Rabbit has a rectangular farmland of n*m. In each of the grid there is a kind of plant. The plant in the j-th column of the i-th row belongs the a[i][j]-th type. White Cloud wants to help White Rabbit fertilize plants, but the i-th plant c