D - Daydreaming Stockbroker Gym - 101550D】的更多相关文章

题目链接:http://codeforces.com/gym/101550/attachments 总的来说就是要: 极大值卖出,极小值买入, 再加上端点时的特判. 还有就是会有连续几天股票价格相同的情况,这里就是判断的时候是严格的大于小于号的功劳了 首先手里肯定是没有股票的, 尝试买入第一天的股票, 如果下一天的股票价格低于当天的股票价格,我们就再卖出当前的所有股票来让下一天再去尝试买入股票. 除了第一天尝试买入股票的时候, 买入股票的时候应该是极小值, 我们可以一次次尝试:(如果当天的价格低…
题目: Gina Reed, the famous stockbroker, is having a slow day at work, and between rounds of solitaire she is daydreaming. Foretelling the future is hard, but imagine if you could just go back in time and use your knowledge of stock price history in or…
A. Artwork 倒过来并查集维护即可. #include<cstdio> #include<algorithm> using namespace std; const int N=1111; int n,m,q,i,j,ce; bool black[N][N]; bool v[N*N]; int f[N*N]; int res; int ans[N*N],id[N][N],cnt; struct P{ int x,y; P(){} P(int _x,int _y){x=_x,…
A .Artwork pro:给定N*M的白色格子,然后Q次黑棒,输出每次加黑棒后白色连通块的数量.(N,M<1e3, Q<1e4) sol:倒着离线做,并查集即可. (在线做法:https://www.cnblogs.com/asdfsag/p/10485607.html #include<bits/stdc++.h> #define ll long long #define rep(i,a,b) for(int i=a;i<=b;i++) using namespace…
A Artwork B Bless You Autocorrect! C Card Hand Sorting D Daydreaming Stockbroker 贪心,低买高卖,不要爆int. #include <cstdio> #include <cstring> #include <algorithm> #include <iostream> using namespace std; typedef long long LL; const int max…
Daydreaming Stockbroker Gina Reed, the famous stockbroker, is having a slow day at work, and between rounds of solitaire she is day-dreaming. Foretelling the future is hard, but imagine if you could just go back in time and use your knowledge of stoc…
 Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Andréh and his friend Andréas are board-game aficionados. They know many of their friend…
 Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Thai cuisine is known for combining seasonings so that every dish has flavors that are…
Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Practice  Description standard input/output Ayutthaya was one of the first kingdoms in Thailand, spanning since its foundation in 1350 to…
 Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output At the ruins of Wat Phra Si Sanphet (วดพระศรสรรเพชญ), one can find famous inscr…