codeforces 665B Shopping】的更多相关文章

暴力 #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<map> #include<stack> #include<queue> #include<string> #include<algorithm> using namespace std; int n,m,k; ],b[]; int pos(…
题目链接: B. Shopping time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output   Ayush is a cashier at the shopping center. Recently his department has started a ''click and collect" service which allow…
题意(来自网络): 现在有k件商品,每个商品的位置已经告诉你了 现在有n个人,每个人有m个需求,每个需求就是要把第a[i][j]个物品拿到第一个位置来 他的代价是pos[a[i][j]] 问你所有代价是多少 思路: 就是每次+,每次调整,还有滚动数组这种不错欸~ #include <bits/stdc++.h> using namespace std; typedef __int64 LL; int pos[2][110]; int main() { int n,m,k; scanf(&quo…
Shopping 题目连接: http://codeforces.com/gym/100803/attachments Description Your friend will enjoy shopping. She will walk through a mall along a straight street, where N individual shops (numbered from 1 to N) are aligned at regular intervals. Each shop…
A. Patrick and Shopping Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/A Description Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two…
B. Shopping 题目连接: http://www.codeforces.com/contest/665/problem/B Description Ayush is a cashier at the shopping center. Recently his department has started a ''click and collect" service which allows users to shop online. The store contains k items.…
膜拜大佬:https://blog.csdn.net/xyz32768/article/details/88831233 题目链接: http://codeforces.com/contest/1139/problem/F 题意: 有n个物品,物品有三个属性分别是$p_i,s_i,b_i$ 有m个人,人有两个属性分别是$pref_j$,$inc_j$ 一个人能买某个物品必须满足:, $p_i \leq inc_j \leq s_i$ $|b_i-pref_j| \leq (inc_j-p_i)$…
Dish Shopping 将每个物品拆成p 和 s 再加上人排序. 然后问题就变成了, 对于一个线段(L - R), 问有多少个(li, ri)满足  L >= li && R >= ri, 这个东西可以直接树状数组套平衡树维护. 但是这个题目有个特殊性,因为排好序之后不会存在 li > L && ri > R的点, 所以可以直接 用平衡树, 或者线段树去维护这个东西. 平板电视 #include<bits/stdc++.h> #inc…
题目链接:http://codeforces.com/contest/1009/problem/A 解题心得: 题意就是给你两个数列c,a,你需要从c中选择一个子串从a头开始匹配,要求子串中的连续的前k个数都要比对应的a中数小,问k最大是多少. 大比赛的时候自己在枚举题意,搞了好久心态差点崩了. #include <bits/stdc++.h> using namespace std; ; int n,m; int a[maxn],c[maxn]; void init() { scanf(&q…
A. Patrick and Shopping   Today Patrick waits for a visit from his friend Spongebob. To prepare for the visit, Patrick needs to buy some goodies in two stores located near his house. There is a d1 meter long road between his house and the first shop…