摘要:
P1064 [NOIP2006 提高组] 金明的预算方案 思路:有依赖的背包。主要的问题和解决方案,见代码注释. #include <bits/stdc++.h> using namespace std; #define int long long #define endl "\n" const i 阅读全文
摘要:
总结:这场比赛主要是得写出F题才能跨层。五题看罚时。以后能用next_permutation就不要用dfs,dfs写得比较长,浪费时间。然后B那题String,用stack模拟即可,不用想其他离奇的实现,又是浪费时间。 Problem - F - Codeforces-Photography 题意: 阅读全文
摘要:
C-耕种时间到 思路:模拟即可o(log3(1e9)*log3(1e9)*n) int arr[100005]; void solve(){ int n; cin>>n; int ans=0,cur=0; for(int i=1;i<=n;i++) cin>>arr[i]; int k; cin>> 阅读全文
摘要:
这场打的非常坐牢。。除了签到题。赛时一题想不出来。。纯纯坐牢五个小时。但是题目还不错,值得一补。 A-Maximum Element In A Stack 思路:用题目给出的函数生成操作。这题用multiset来模拟,o(nlogn)是TLE的。需要o(n)的做法 >维护单调栈。当push元素比栈顶 阅读全文