fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7.  
  8. int minTime = 1e9; // A large value to track the minimum time
  9.  
  10. for (int i = 0; i < n; i++) {
  11. int k;
  12. cin >> k; // Number of people in the current cashier's queue
  13.  
  14. int totalTime = 0;
  15. for (int j = 0; j < k; j++) {
  16. int m;
  17. cin >> m; // Number of items the j-th person has
  18.  
  19. totalTime += 5 * m + 15; // 5 seconds per item + 15 seconds per customer
  20. }
  21.  
  22. // Add Vasya's own time: He has no items, so only 15 seconds to check out
  23. totalTime += 15;
  24.  
  25. minTime = min(minTime, totalTime); // Update the minimum time
  26. }
  27.  
  28. cout << minTime << endl; // Output the minimum waiting time
  29.  
  30. return 0;
  31. }
  32.  
Success #stdin #stdout 0.01s 5312KB
stdin
1
1
1
stdout
35