#include #include #include #include #include using namespace std; /** * Author * Robin Lee (hex539) * * Solution * Dynamic programming with state as last car in each direction plus the number * satisfied so far and function as minimum time taken. * * Complexity * O(N^3) */ #define MAXN 800 uint32_t dp[2][2][MAXN/2+1][MAXN+1]; void up(uint32_t &x,uint32_t y){if (y a,b; int main(){ int t,n; cin>>t>>n; for (int i=0; i>dirn>>c.start>>c.end; c.end+=c.start; c.dir=(dirn=='E'); (dirn=='E'? a: b).push_back(c); } } if (a.size()