上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 63 下一页
摘要: ```//对于每个元素,往前看N/2个//当前是i,前面是j//i-j+a[i]+a[j]=i+a[i]+a[j]-j//i是固定的,所以可以用滑动窗口优化,单调队列 #include#include#include#includeusing namespace std;const int N=2e6+10;int n;int w[N];int q[N];int main(){ cin>>n... 阅读全文
posted @ 2020-03-26 16:49 晴屿 阅读(82) 评论(0) 推荐(0) 编辑
摘要: ``` //f[i,j,0],考虑了前i小时,且一共睡了j小时,且第i小时不睡觉的最大收益 //f[i,j,1],考虑了前i小时,且一共睡了j小时,且第i小时在睡觉的最大收益 //f[i,j,0]=max{f[i-1,j,0],f[i-1,j,1]} //f[i,j,1]=max{f[i-1,j-1,0],f[i-1,j-1,1]+w[i]} //第N小时不在睡觉的话 //f[1,1,0]=0,f 阅读全文
posted @ 2020-03-26 16:47 晴屿 阅读(87) 评论(0) 推荐(0) 编辑
摘要: ``` #include #include #include #include using namespace std; const int N=4e5+10; int e[N],w[N],h[N],ne[N],idx; int ans; int n; int deg[N]; int d[N]; int dp[N]; void add(int a,int b,int c) { e[idx]=b; 阅读全文
posted @ 2020-03-26 11:42 晴屿 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 总感觉之前做过一个类似的 阅读全文
posted @ 2020-03-25 19:51 晴屿 阅读(139) 评论(0) 推荐(0) 编辑
摘要: ``` #include #include #include #include using namespace std; const int N=3010; int e[N],h[N],ne[N],idx; int f[N][2]; bool st[N]; void add(int a,int b) { e[idx]=b; ne[idx]=h[a]; h[a]=idx++; } int n,m; 阅读全文
posted @ 2020-03-25 18:21 晴屿 阅读(92) 评论(0) 推荐(0) 编辑
摘要: ``` /* 10 180 10 90*2 2610 180 10 900*3-90 34200 2610 180 10 9000*4-900*2 423000 34200 2610 180 10 90000*5-9000*3 5040000 423000 34200 2610 180 10 900000*6-90000*4 */ #include #include #include #inclu 阅读全文
posted @ 2020-03-24 09:55 晴屿 阅读(206) 评论(0) 推荐(0) 编辑
摘要: ``` #include #include #include #include #define int long long using namespace std; const int N=30000+10; const int mod=1000007; int a[N]; int read() { int res=0,ch,flag=0; if((ch=getchar())=='-') //判断 阅读全文
posted @ 2020-03-23 18:38 晴屿 阅读(90) 评论(0) 推荐(0) 编辑
摘要: ``` #include #include #include #include using namespace std; const int N=300000+10; const int mod=1000007; //直接dp //dp[i]表示放了多少花 int dp[110]; int a[N]; int m,n; int main() { cin>>n>>m; for(int i=1;i>a 阅读全文
posted @ 2020-03-23 18:02 晴屿 阅读(98) 评论(0) 推荐(0) 编辑
摘要: ``` #include #include #include #include using namespace std; const int N=300000+10; int dp[N]; int m,s,t; int main() { cin>>m>>s>>t; for(int i=1;i=10) dp[i]=dp[i-1]+60,m-=10; else dp[i]=dp[i-1],m+=4; 阅读全文
posted @ 2020-03-23 17:29 晴屿 阅读(117) 评论(0) 推荐(0) 编辑
摘要: ``` #include #include #include #include using namespace std; const int N=1010; int a[N]; int sum; int main() { int t; cin>>t; while(t--) { int n; cin>>n; sum=0; int pos=0; for(int i=1;i>a[i]; sum+=a[i 阅读全文
posted @ 2020-03-21 21:04 晴屿 阅读(294) 评论(0) 推荐(0) 编辑
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 63 下一页