n a subordinate, each of the men to complete a task. Each task must be B time confessed, J time execution.
Cannot give two subordinates simultaneous account of the task.
Outputs the shortest time to complete all tasks.
Uva 11792#include <algorithm> #include <iostream> #include <cstring> #include <cstdio># Include <string> #include <stack> #include <queue> #include <set> #include <map>typedef Long long ll;using namespace std;const int inf=0x3f3f3f3f;const int maxn=100;struct job{int B,j;bool operator < (const Job &a) Const { return j<a.j;//max Precedence }};int main () {priority_queue<job>q;job temp;int n;int ct=1; while (Cin>>n && n>0) {while (!q.empty ()) Q.pop (), for (int i=0;i<n;++i) {cin>>temp.b>> Temp.j;q.push (temp);} int s=0,mmax=0;for (int i=0;i<n;++i) {temp=q.top ();//cout<<temp.b<< ""; S+=temp.b;mmax=max (mmax,s+ TEMP.J); Q.pop ();} printf ("Case%d:%d\n", Ct++,mmax);} return 0;}
[Water] UVA 11792 Commando War