比赛 假期找点事儿做题吧 评测结果 AAAAAAAAAA
题目名称 守望者的逃离 最终得分 100
用户昵称 FFF团 运行时间 0.005 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2017-06-18 18:45:54
显示代码纯文本
#include<map>
//#include<>
#include<cstdio>
#include<iostream>
using namespace std;
int now_mp,now_s,now_time,ans=0x7fffffff,s,t,max_s;
typedef pair<int,int>state;
state temp;
map<state,bool>vis;
void dfs(int n_s,int n_time,int n_mp){
	temp.first=n_time;temp.second=n_mp;
	vis[temp]=1;
	//cout<<n_s<<" "<<n_time<<" "<<n_mp<<endl;
	if(n_time>t)return ;
	if(n_time==t||n_s>=s){
		if(n_time==t)max_s=max(max_s,n_s);
		if(n_s>=s)ans=min(ans,n_time);
		return ;
	}
	if(n_mp>=10){
		temp.first++;temp.second-10;
		if(!vis[temp])dfs(n_s+60,n_time+1,n_mp-10);
	}

	else{
		temp.first++;
		temp.second+=4;
		if(!vis[temp])dfs(n_s,n_time+1,n_mp+4);
		temp.second-=4;
		if(!vis[temp])dfs(n_s+17,n_time+1,n_mp);

	}
	return ;
}
void flash(){
	now_s+=60;
	now_mp-=10;
	now_time++;
}
void rest(){
	now_mp+=4;
	now_time++;
}
int main(){
	freopen("escape.in","r",stdin);
	freopen("escape.out","w",stdout);
	scanf("%d%d%d",&now_mp,&s,&t);
	while(now_mp>=10&&now_time+1<=t)flash();
	while(s-now_s>=120&&(t-now_time)*4>=10){
		if(now_mp>=10)flash();
		else if(s-now_s<120)break;
		else if((t-now_time)*4>=10)rest();
	}
	max_s=now_s;
	dfs(now_s,now_time,now_mp);
	if(ans!=0x7fffffff)printf("Yes\n%d",ans);
	else printf("No\n%d",max_s);
	return 0;
}