You are viewing a single comment's thread. Return to all comments →
long minTime(vector<long> machines, long goal) { map<int,int> m; for(int i=0;i<machines.size();i++){ m[machines[i]]++; } // for(const auto &x : m){ // cout << x.first << " "<< x.second << endl; // } long production =0; long days =0; map<int,int>::iterator it; while(goal > production){ days++; long cprod = 0; for(it = m.begin();it!=m.end();it++){ if(days/it->first==0) break; cprod+=(days/it->first)*(it->second); } production = cprod; } return days; }
can anyone help me 5,7,8,9 testcase running timeout
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Time Required
You are viewing a single comment's thread. Return to all comments →
can anyone help me 5,7,8,9 testcase running timeout