#include using namespace std; int timeStrToMin(const string &s) { int h = stoi(s.substr(0,2)); int m = stoi(s.substr(3,2)); return h * 60 + m; } string minToTimeStr(int t) { int h = t / 60; int m = t % 60; char buf[6]; snprintf(buf, sizeof(buf), "%02d:%02d", h, m); return string(buf); } int flightDurationMin(double x1, double y1, double x2, double y2) { double dx = x1 - x2; double dy = y1 - y2; double d = sqrt(dx*dx + dy*dy); double raw = 60.0 * d / 800.0 + 40.0; int dur = (int)ceil(raw / 5.0) * 5; return dur; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; int R; if (!(cin >> N >> R)) return 0; vector> coords(N); vector pops(N); for (int i = 0; i < N; ++i) { double x, y; long long w; cin >> x >> y >> w; coords[i] = {x, y}; pops[i] = w; } int M; cin >> M; // read and ignore Square airline flights (we don't use them here) for (int i = 0; i < M; ++i) { int a, b; string s, t; cin >> a >> s >> b >> t; (void)a; (void)s; (void)b; (void)t; } int K; cin >> K; const int DAY_START = 6 * 60; // 06:00 = 360 const int DAY_END = 21 * 60; // 21:00 = 1260 // RNG (fixed seed for reproducibility) std::mt19937 rng(42); std::uniform_int_distribution cityDist(1, max(1, N)); // For each plane, build a sequence of flights vector>> schedules; // per plane: list of (a, smin, b, tmin) schedules.reserve(K); for (int p = 0; p < K; ++p) { vector> flights; if (N == 0) { schedules.push_back(flights); continue; } int cur_city = cityDist(rng); // 1..N int cur_time = DAY_START; while (true) { // pick next city different from cur_city (try a few times) int next_city = cityDist(rng); int tries = 0; while (next_city == cur_city && tries < 10 && N > 1) { next_city = cityDist(rng); ++tries; } if (next_city == cur_city) { // couldn't pick different city; break to avoid infinite loop break; } double x1 = coords[cur_city-1].first; double y1 = coords[cur_city-1].second; double x2 = coords[next_city-1].first; double y2 = coords[next_city-1].second; int dur = flightDurationMin(x1, y1, x2, y2); int depart = cur_time; int arrive = depart + dur; if (depart < DAY_START) { depart = DAY_START; arrive = depart + dur; } // if arrival would exceed DAY_END, stop adding flights if (arrive > DAY_END) break; flights.emplace_back(cur_city, depart, next_city, arrive); // update state: immediate departure allowed cur_city = next_city; cur_time = arrive; if (cur_time >= DAY_END) break; } schedules.push_back(flights); } // Output: for each plane, first the count c_i then c_i lines of "a s b t" for (const auto &flights : schedules) { cout << flights.size() << "\n"; for (const auto &f : flights) { int a, smin, b, tmin; tie(a, smin, b, tmin) = f; cout << a << " " << minToTimeStr(smin) << " " << b << " " << minToTimeStr(tmin) << "\n"; } } return 0; }