建设工程的招标网站有哪些,酒店网站建设范文,百度推广怎么样才有效果,制作一个网页要多少钱传送门 思路很妙…… 有个前提条件#xff1a;血量无限#xff0c;这样话肯定先打会回血的怪#xff0c;再打会掉血的怪 对于会回血的怪#xff0c;按照受到伤害的顺序从小往大打 对于会掉血的怪似乎并不是很好搞#xff0c;考虑#xff1a;将每一时刻的血量函数画出来血量无限这样话肯定先打会回血的怪再打会掉血的怪 对于会回血的怪按照受到伤害的顺序从小往大打 对于会掉血的怪似乎并不是很好搞考虑将每一时刻的血量函数画出来然后反过来看从右往左看这个函数就相当于回血量和掉血量互换会掉血的怪会变成会回血的怪。因为最终的血量是已知的所以按照上面的方法再做一遍就可以了。 #includeiostream
#includecstdio
#includecstdlib
#includectime
#includecctype
#includealgorithm
#includecstring
#includeiomanip
#includequeue
#includemap
#includeset
#includebitset
#includevector
#includestack
#includecmath
//This code is written by Itst
using namespace std;inline int read(){int a 0;char c getchar();bool f 0;while(!isdigit(c) c ! EOF){if(c -)f 1;c getchar();}if(c EOF)exit(0);while(isdigit(c)){a a * 10 c - 48;c getchar();}return f ? -a : a;
}#define PII pair int , int
#define st first
#define nd second
#define PIII pair PII , int
#define auto vector PIII :: iterator
vector PIII mons[2];
long long hp , End;
int N;signed main(){
#ifndef ONLINE_JUDGEfreopen(in,r,stdin);//freopen(out,w,stdout);
#endifN read(); End hp read();for(int i 1 ; i N ; i){int d read() , a read();a d ?mons[0].push_back(PIII(PII(d , a) , i)) :mons[1].push_back(PIII(PII(a , d) , i));End End - d a;}if(End 0){puts(NIE); return 0;}sort(mons[0].begin() , mons[0].end());for(auto t mons[0].begin() ; t ! mons[0].end() ; t){if(hp - (*t).st.st 0){puts(NIE); return 0;}hp hp - (*t).st.st (*t).st.nd;}sort(mons[1].begin() , mons[1].end());for(auto t mons[1].begin() ; t ! mons[1].end() ; t){if(End - (*t).st.st 0){puts(NIE); return 0;}End End - (*t).st.st (*t).st.nd;}puts(TAK);for(auto t mons[0].begin() ; t ! mons[0].end() ; t)printf(%d , (*t).nd);reverse(mons[1].begin() , mons[1].end());for(auto t mons[1].begin() ; t ! mons[1].end() ; t)printf(%d , (*t).nd);return 0;
} 转载于:https://www.cnblogs.com/Itst/p/10585825.html