import random random.seed(0) def output(prefix, n, p, s, c, probs): with open(f'../data/secret/{prefix}.in', 'w') as file: file.write(f'{n} {p} {s} {c}\n') for p in probs: file.write(' '.join(map(str,p))) file.write('\n') # edge cases # small case, everyone stays output('00-edge-00', 3, 1, 1, 1, [(2, 'A', 1, 1, 2)] ) # both go output('00-edge-01', 3, 1, 1, 1, [(2, 'B', 0, 1, 2)] ) # one person can go output('00-edge-02', 3, 1, 2, 2, [(2, 'A', 1, 1, 3)] ) # not everyone can go output('00-edge-03', 3, 1, 2, 2, [(2, 'B', 1, 1, 3)] ) # bottle neck in the middle output('00-edge-04', 9, 2, 5, 3, [(6, 'A', 4, 2, 7), (7, 'B', 2, 1, 3)] ) # one stays output('00-edge-05', 3, 1, 1, 1, [(2, 'A', 0, 0, 1)] ) # one goes output('00-edge-06', 3, 1, 1, 1, [(2, 'B', 0, 0, 1)] ) # not enough time to get there output('00-edge-07', 10, 1, 5, 1, [(5, 'B', 1, 1, 6)] ) # not enough time to come back output('00-edge-08', 10, 1, 5, 1, [(6, 'B', 1, 1, 6)] ) # not enough time to switch teams output('00-edge-09', 11, 2, 7, 4, [(6, 'B', 3, 2, 7), (8, 'A', 6, 4, 10)] ) # now there is enough time output('00-edge-10', 11, 2, 7, 4, [(6, 'B', 3, 2, 7), (10, 'A', 6, 4, 10)] ) output('00-edge-11', 5, 1, 1, 2, [(4, 'A', 0, 0, 3)] ) # single bottleneck # (A, 2, 5, 8) + (B, 7, 3, 11) output('00-edge-12', 30, 5, 13, 11, [(15, 'A', 2, 3, 5), (15, 'B', 7, 1, 11), (15, 'A', 1, 5, 7), (15, 'B', 0, 3, 3), (15, 'A', 0, 1, 8)] ) max_sc = 35 num_probs = 5 # start with 10 small random def generate_small(): n = 2 s = random.randint(1, max_sc) c = random.randint(1, max_sc) p = random.randint(1, num_probs) probs = [] for _ in range(p): t = n + random.randint(0, 100) n = t g = random.choice('AB') a = random.randint(0,s) b = random.randint(0,c) comb = random.randint(max(1,a+b),s+c) probs += [(t, g, a, b, comb)] n += random.randint(1,99) return n, p, s, c, probs for i in range(10): output(f'01-rand-small-{i:02d}', *generate_small()) # TLE worst def generate_worst(): p = num_probs step = 2**57-1 n = step*6+1 probs = [] for i in range(p): a=random.randint(0,max_sc) b=random.randint(0,max_sc) probs += [(1+step*(i+1), random.choice('AB'), a, b, random.randint(max(1,a+b), 2*max_sc))] return n, p, max_sc, max_sc, probs for i in range(5): output(f'02-worst-{i:02d}', *generate_worst()) # Generate almost worst to prevent worst-case caching def generate_almost_worst(): p = num_probs s = random.randint(max_sc-5, max_sc) c = random.randint(max_sc-5, max_sc) step = 2**57-1 n = 2 sample = list(range(57)) def get_step(): ans = step for i in random.sample(sample, 4): ans ^= 1<