显示原始代码
#include <stdio.h>
int timeSpend[100001], timeReward[100001];
int main() {
int roomTotal, rewardTotal, timeLeft;
scanf("%d %d %d", &roomTotal, &rewardTotal, &timeLeft);
for (int idx = 1; idx <= roomTotal - 1; idx++) scanf("%d", &timeSpend[idx]);
for (int idx = 1, tmp; idx <= rewardTotal; idx++) {
scanf("%d", &tmp);
scanf("%d", &timeReward[tmp]);
}
int step = 1;
for (;; step++) {
timeLeft = timeLeft + timeReward[step] - timeSpend[step];
if (timeLeft <= 0 || step == roomTotal)
break;
}
step == roomTotal ? printf("Yes") : printf("No");
}
}