Topcoder SRM149 Div1 Level 1 BigBurger
問題
http://community.topcoder.com/stat?c=problem_statement&pm=1648&rd=4550
解法
まだ
コード
#include <bits/stdc++.h> #include <stdint.h> #include <sys/time.h> class BigBurger{ public: int maxWait(std::vector<int> arrival, std::vector<int> service) { int end[64]; int n = arrival.size(); end[0] = arrival[0] + service[0]; for(int i = 1; i < n; ++i) { end[i] = std::max(0, end[i-1] - arrival[i]) + arrival[i] + service[i]; } int wait[64] = {}; for(int i = 1; i < n; ++i) { wait[i] = std::max(0, end[i-1] - arrival[i]); } int res = wait[0]; for(int i = 1; i < n; ++i) { res = std::max(res, wait[i]); } return res; } };