#include "testlib.h" #include using namespace std; const int MIN_N = 1; const int MAX_N = 100; const int MIN_W = 1; const int MAX_W = 1e5; const int MIN_V = 1; const int MAX_V = 1e9; const int rnd_test_n = 100; template void append(vector &dest, const vector &orig) { dest.insert(dest.end(), orig.begin(), orig.end()); } string output_tc(const vector> &nums, int W) { ostringstream oss; oss << nums.size() << " " << W << endl; for (int i = 0; i < nums.size(); i++) { auto [w, v] = nums[i]; oss << w << " " << v << endl; } return oss.str(); } vector generate_sample_tests() { vector tests; tests.push_back(output_tc({{3, 30}, {4, 50}, {5, 60}}, 8)); tests.push_back(output_tc({{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}}, 5)); tests.push_back(output_tc({{6, 5}, {5, 6}, {6, 4}, {6, 6}, {3, 5}, {7, 2}}, 15)); return tests; } vector generate_manual_tests() { vector tests; tests.push_back(output_tc({{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}, 15)); return tests; } string rnd_test(int i){ int min_n = MIN_N; int max_n = MAX_N; if(i> nums(n); for (int i = 0; i < n; i++) { nums[i] = {rnd.next(MIN_W, w), rnd.next(MIN_V, MAX_V)}; } return(output_tc(nums, w)); } vector generate_random_tests() { vector tests; for (int i = 0; i < rnd_test_n; i++){ tests.push_back(rnd_test(i)); } return tests; } string extreme_test_1(){ int n = MAX_N, w = MAX_W; vector> nums(n); for (int i = 0; i < n; i++) { nums[i] = {MIN_W, MAX_V}; } return(output_tc(nums, w)); } string extreme_test_2(){ int n = MAX_N, w = MAX_W; vector> nums(n); for (int i = 0; i < n; i++) { nums[i] = {MIN_W, MIN_V}; } return(output_tc(nums, w)); } vector generate_extreme_tests(){ vector tests; tests.push_back(extreme_test_1()); tests.push_back(extreme_test_2()); return tests; } int main(int argc, char *argv[]) { registerGen(argc, argv, 1); vector tests; size_t test = 0; append(tests, generate_sample_tests()); append(tests, generate_manual_tests()); append(tests, generate_random_tests()); append(tests, generate_extreme_tests()); for (const auto &t : tests) { startTest(++test); cout << t; } return 0; }