431 守望者的逃离
作者:
jy9
,
2024-10-16 21:29:14
,
所有人可见
,
阅读 1
#include <iostream>
#include <cstring>
using namespace std;
const int N = 300010;
int m, s, T, ans = -1;
bool flag = 0;
int dist[N];
void dfs(int t, int dis, int mm){
if(dist[t] >= dis && t != 0) return;
if(t == T+1) return;
dist[t] = max(dis, dist[t]);
if(mm >= 10){
dfs(t+1, dis+60, mm - 10);
}else dfs(t+1, dis, mm + 4);
dfs(t+1, dis+17, mm);
}
int main(){
cin >> m >> s >> T;
//memset(dist, 0x3f, sizeof dist);
dfs(0, 0, m);
if(dist[T] >= s){
cout << "Yes" << endl;
for(int i = T; i >= 0; i--){
if(dist[i] >= s) ans = i;
}
cout << ans << endl;
}else{
cout << "No" << endl;
cout << dist[T];
}
return 0;
}