#include using namespace std; struct City { double x, y; long long w; }; struct Flight { int a; int dep; int b; int arr; }; // times in minutes from midnight int travel_time_minutes(double x1, double y1, double x2, double y2) { double d = hypot(x1 - x2, y1 - y2); double raw = 60.0 * d / 800.0 + 40.0; int tt = (int)ceil(raw / 5.0) * 5; return tt; } string fmt_time(int t){ int hh = t / 60; int mm = t % 60; char buf[6]; sprintf(buf, "%02d:%02d", hh, mm); return string(buf); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; int R; if(!(cin >> N >> R)) return 0; vector cities(N); for(int i=0;i> xi >> yi >> wi; cities[i].x = (double)xi; cities[i].y = (double)yi; cities[i].w = wi; } int M; cin >> M; // Read and ignore Square airline flights (keep robust: read tokens) for(int i=0;i> a >> s_str >> b >> t_str; } int K; cin >> K; // RNG (fixed seed optional for reproducibility) std::mt19937_64 rng((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count()); // std::mt19937_64 rng(12345); // <- 再現性が欲しいならこちらを使う const int START = 6*60; // 360 const int END = 21*60; // 1260 vector> schedules(K); // For each plane, pick a random start city, then keep flying until no next city fits in remaining time for(int k=0;k uni(0, N-1); int cur = uni(rng); int time = START; while(true){ // prepare shuffled list of candidate next cities vector cand(N); iota(cand.begin(), cand.end(), 0); shuffle(cand.begin(), cand.end(), rng); bool found = false; for(int idx = 0; idx < N; ++idx){ int nxt = cand[idx]; if(nxt == cur) continue; int tt = travel_time_minutes(cities[cur].x, cities[cur].y, cities[nxt].x, cities[nxt].y); int dep = time; // depart as soon as possible (time is always multiple of 5) int arr = dep + tt; if(arr > END) continue; // can't arrive before end of service // accept this flight schedules[k].push_back({cur, dep, nxt, arr}); cur = nxt; time = arr; found = true; break; } if(!found) break; // no reachable next city within remaining time } } // Output per problem spec: for each aircraft 1..K, print c_i then the flights for(int k=0;k