daily pastebin goal
88%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     int minutesToQuit = 2;
  2.     int minutesToEnter = 0;
  3.     queue<Student*> que;
  4.     students.front()->setInQue(minutesToEnter);
  5.     students.front()->setOutOfQue(minutesToQuit);
  6.     que.push(students.front());
  7.     students.pop();
  8.     while (!students.empty()) {
  9.         ++minutesToQuit;
  10.         Student* student = students.front();
  11.         if (minutesToEnter % 2 == 1) {
  12.             student->setInQue(minutesToEnter);
  13.             student->setOutOfQue(minutesToQuit);
  14.             que.push(student);
  15.  
  16.             queue<Student*> tmp = map.getQueueAtKey(student->getGroupNumber());
  17.  
  18.             if (!tmp.empty()) {
  19.                 while (!tmp.empty()) {
  20.                     tmp.front()->setInQue(minutesToEnter);
  21.                     tmp.front()->setOutOfQue(minutesToQuit);
  22.                     que.push(tmp.front());
  23.                     tmp.pop();
  24.                 }
  25.             }
  26.         }
  27.         if (minutesToQuit % 2 == 0) {
  28.             students.pop();
  29.         }
  30.         ++minutesToEnter;
  31.     }
  32.     while (!que.empty()) {
  33.         std::cout << que.front()->getName() << " " << que.front()->getOutOfQue() - que.front()->getInQue() << "m\n";
  34.         que.pop();
  35.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top