2101: [Usaco2010 Dec]Treasure Chest 藏宝箱 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 327 Solved: 147[Submit][Status] Description Bessie and Bonnie have found a treasure chest full of marvelous gold coins! Being cows, though, they can't just walk i…
dp( l , r ) = sum( l , r ) - min( dp( l + 1 , r ) , dp( l , r - 1 ) ) 被卡空间....我们可以发现 l > r 是无意义的 , 所以可以省下一半的空间 -------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<a…
2101: [Usaco2010 Dec]Treasure Chest 藏宝箱 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 592 Solved: 319[Submit][Status][Discuss] Description Bessie and Bonnie have found a treasure chest full of marvelous gold coins! Being cows, though, they can't ju…
http://www.lydsy.com/JudgeOnline/problem.php?id=2101 Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 539 Solved: 294[Submit][Status][Discuss] Description Bessie and Bonnie have found a treasure chest full of marvelous gold coins! Being cows, though,…
就是区间dp啦f[i][j]表示以i开头的长为j+1的一段的答案,转移是f[i][j]=s[i+l]-s[i-1]+min(f[i][j-1],f[i+1][j-1]),初始是f[i][1]=a[i] 于是可以把j维推掉 #include<iostream> #include<cstdio> using namespace std; const int N=5005; int n,a[N],s[N]; int main() { scanf("%d",&n…
2101: [Usaco2010 Dec]Treasure Chest 藏宝箱 Time Limit: 10 Sec Memory Limit: 64 MB Submit: 418 Solved: 206 [Submit][Status][Discuss] Description Bessie and Bonnie have found a treasure chest full of marvelous gold coins! Being cows, though, they can't…
我猜我这样继续做水题会狗带 和模拟赛的题很像,贪心搞一下. #include<bits/stdc++.h> using namespace std; int read(){ ,f=;char ch=getchar(); ;ch=getchar();} +ch-';ch=getchar();} return x*f; } #define N 100005 int n,m,f[N],q[N],cnt; struct Node{ int to,next; }e[N<<]; int tot…
G - Zombie’s Treasure Chest Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Description Some brave warriors come to a lost village. They are very lucky and find a lot of treasures and a big treasure chest,…
2102: [Usaco2010 Dec]The Trough Game Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 117 Solved: 84[Submit][Status] Description Farmer John and Bessie are playing games again. This one has to do with troughs of water. Farmer John has hidden N (1 <= N…
Zombie’s Treasure Chest Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4442 Accepted Submission(s): 889 Problem Description Some brave warriors come to a lost village. They are very lucky…
P3004 [USACO10DEC]宝箱Treasure Chest 题目描述 Bessie and Bonnie have found a treasure chest full of marvelous gold coins! Being cows, though, they can't just walk into a store and buy stuff, so instead they decide to have some fun with the coins. The N (1…
1479: Treasure Chest Lock Time Limit: 1 Sec Memory Limit: 128 MB Submit: 7 Solved: 5 [id=1479">Submit][id=1479">Status][Web Board] Description Vic has a treasure chest. And there is a lock on the treasure chest. The lock contains a seque…
P3004 [USACO10DEC]宝箱Treasure Chest 题目描述 Bessie and Bonnie have found a treasure chest full of marvelous gold coins! Being cows, though, they can't just walk into a store and buy stuff, so instead they decide to have some fun with the coins. The N (1…
12325 Zombie’s Treasure Chest Some brave warriors come to a lost village. They are very lucky and find a lot of treasures and a big treasure chest, but with angry zombies. The warriors are so brave that they decide to defeat the zombies and then brin…
暴力枚举答案然后检验. #include<cstdio> int n,m,i,j,k,a[100],b[100],cnt,ans;char s[20]; int main(){ for(scanf("%d%d",&n,&m);i<m;i++)for(scanf("%s%d",s,&b[i]),j=0;j<n;j++)if(s[j]=='1')a[i]|=1<<j; for(i=0;i<(1<&l…
Description Bessie has two crisp red apples to deliver to two of her friends in the herd. Of course, she travels the C (1 <= C <= 200,000) cowpaths which are arranged as the usual graph which connects P (1 <= P <= 100,000) pastures convenientl…