记录编号 | 445441 | 评测结果 | AAAAAAAAAAT | ||
---|---|---|---|---|---|
题目名称 | 不平凡的boss | 最终得分 | 90 | ||
用户昵称 | 是否通过 | 未通过 | |||
代码语言 | C++ | 运行时间 | 1.307 s | ||
提交时间 | 2017-09-05 22:11:34 | 内存使用 | 1.46 MiB | ||
#include<bits/stdc++.h> #define MAXN 100010 #define INF 0x7fffffff using namespace std; int a[MAXN],b[MAXN],c[MAXN],N,ans=INF; void DFS(int now,int x,int y,int z){ if(now>N)ans=min(ans,x+y+z); if(x+y+z>=ans)return; if(a[now]<=x||b[now]<=y||c[now]<=z){ DFS(now+1,x,y,z); return; } DFS(now+1,a[now],y,z); DFS(now+1,x,b[now],z); DFS(now+1,x,y,c[now]); } int main(){ freopen("playwithboss.in","r",stdin); freopen("playwithboss.out","w",stdout); scanf("%d",&N); for(int i=1;i<=N;i++){scanf("%d%d%d",&a[i],&b[i],&c[i]);} DFS(1,0,0,0); printf("%d",ans); return 0; }