Hi!
dont spend more than 10 minutes reading this,I probably should not even be posting this.
Any way I have this piece of code which has some syntax error in the STL part and I cannot make any sense of the error message I get , below is the code just glance through it to see if u can find any glaring mistakes.
thanks!
-----------------------------------------------------------------------------------------------------------------
Code:#define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(),(c).end() #define REP(i,n) for(int _n=n, i=0;i<_n;++i)//for loop #define max 1000001 class KiloManX { public: int leastShots(vector <string>, vector <int>); }; int KiloManX::leastShots(vector <string> damageChart, vector <int> bossHealth) { int n,m; n=sz(damageChart); int i,j; vector<int> damage[n]; REP(i,n) REP(j,n) { damage[i].push_back( ceil( bossHealth[j]/float(damageChart[i][j]-'0') ) ); } vector<int> d(n,max); set<pair<int,int> > q; int shots=1; int start=bossHealth.begin()-find(all(bossHealth),min_element(all(bossHealth) ) ); d[start]=*min_element(all(bossHealth)); q.insert(make_pair(d[start],start)); while(!q.empty()) { pair<int ,int> top; top=*q.begin(); q.erase(q.begin()); int cost=top.first; int index=top.second; REP(j,n) { if(d[j]>damage[index][j]+cost) { if(d[j]!=max) q.erase(q.find(make_pair(d[j],j))); d[j]=damage[index][j]+cost; q.insert(make_pair(d[j],j)); } } } return *max_element(all(d)); }



LinkBack URL
About LinkBacks




ush_back(const _Tp&) [with _Tp = int, _Alloc = std::allocator<int>]'
perator* [with _Iterator = int*, _Container = std::vector<int, std::allocator<int> >]() == __val'