- 守望者的逃离
- 2016-09-01 12:57:48 @
评测结果
编译成功
测试数据 #0: Accepted, time = 0 ms, mem = 2904 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 2904 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 2908 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 2904 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 2908 KiB, score = 10
测试数据 #5: TimeLimitExceeded, time = 1203 ms, mem = 2904 KiB, score = 0
测试数据 #6: Accepted, time = 0 ms, mem = 2904 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 2904 KiB, score = 10
测试数据 #8: TimeLimitExceeded, time = 1203 ms, mem = 2904 KiB, score = 0
测试数据 #9: Accepted, time = 0 ms, mem = 2908 KiB, score = 10
TimeLimitExceeded, time = 2406 ms, mem = 2908 KiB, score = 80
代码
#include <algorithm>
#include <iostream>
using namespace std;
int m,s,t,MaxDist;
struct DP {
int f,g;
}dp[300001];
inline void dfs(int nowtime,int nowm,int nowdist) {
MaxDist = max(MaxDist,nowdist);
if (!nowtime) return;
if (nowm >= 10) dfs(nowtime-1,nowm-10,nowdist+60);
else dfs(nowtime-1,nowm+4,nowdist);
}
int main() {
ios :: sync_with_stdio(false);
cin >> m >> s >> t;
dp[0].f = dp[0].g = 0;
for (int i = 1;i <= t;i++) {
MaxDist = -9999999;
dfs(i,m,0);
dp[i].g = MaxDist;
dp[i].f = max(dp[i-1].f+17,dp[i].g);
}
if (dp[t].f < s) {
cout << "No\n" << dp[t].f;
return 0;
}
while (dp[t].f >= s) t--;
cout << "Yes\n" << ++t;
return 0;
}
0 条评论
目前还没有评论...