#include #include #include #include #include using namespace std; const int max_switches = 500000; const long long max_balls = 1000000000000000000LL; int testcase_num; long long balls; int switches; string state; vector left_switch, right_switch; void save(string testcase_id) { char filename[100]; sprintf(filename, "data/secret/%02d_%s.in", testcase_num, testcase_id.c_str()); cout << "saving: " << filename << endl; testcase_num++; ofstream out(filename); out << balls << " " << switches << endl; for (int i=0; i(switches, -1); } void update(vector perm) { string new_state = state; vector new_left_switch = left_switch; vector new_right_switch = right_switch; for (int i=0; i perm; for (int i=0; i perm; for (int i=0; i switches) left_switch[i] = 0; right_switch[i] = i + 2 + random() % 10; if (right_switch[i] > switches) right_switch[i] = 0; } shuffle(); } void testcase_randoms() { int exp = 2; for (int switches = 100; switches <= max_switches; switches *= 10) { create_random(max_balls - random()%100, switches - random()%100); char filename[100]; sprintf(filename, "random_1e%d", exp); save(filename); exp++; } } void testcase_zero_balls() { create_random(0, switches - random()%100); save("zero_balls"); } void testcase_asymmetric_parts() { int switches = max_switches; set_size(max_balls - 71, switches); int i=0; while (i