// 15 cases each of random n = 2, 3, ... // 10 cases each of ties n = 2, 3, ... // 5 cases each of single majority winner // 5 cases each of single minority winner // 10 cases each on boundary between majority and minority #include #include #include using namespace std; random_device rd; default_random_engine e1(rd()); int rand_int(int low, int high) { uniform_int_distribution uniform_dist(low, high); return uniform_dist(e1); } int main() { cout << 45*9 << endl; for (int n = 2; n <= 10; n++) { // random for (int c = 0; c < 15; c++) { cout << n << endl; for (int i = 0; i < n; i++) { cout << rand_int(1,50000) << endl; } } // ties for (int c = 0; c < 10; c++) { cout << n << endl; int maxvote = rand_int(100,50000); int win1 = rand_int(0, n-2); int win2 = rand_int(win1+1, n-1); for (int i = 0; i < n; i++) { if (i != win1 && i != win2) { cout << rand_int(0, maxvote-1) << endl; } else { cout << maxvote << endl; } } } // majority winner for (int c = 0; c < 5; c++) { int win = rand_int(0, n-1); int vote[10]; int total = 0; for (int i = 0; i < n; i++) { vote[i] = (i == win) ? 0 : rand_int(0, 100); total += vote[i]; } vote[win] = total + rand_int(1,1000); cout << n << endl; for (int i = 0; i < n; i++) { cout << vote[i] << endl; } } // majority winner boundary for (int c = 0; c < 5; c++) { int win = rand_int(0, n-1); int vote[10]; int total = 0; for (int i = 0; i < n; i++) { vote[i] = (i == win) ? 0 : rand_int(0, 100); total += vote[i]; } vote[win] = total + 1; cout << n << endl; for (int i = 0; i < n; i++) { cout << vote[i] << endl; } } // minority winner boundary for (int c = 0; c < 5; c++) { int win = rand_int(0, n-1); int vote[10]; int total = 0; for (int i = 0; i < n; i++) { vote[i] = (i == win) ? 0 : rand_int(0, 100); total += vote[i]; } vote[win] = total; cout << n << endl; for (int i = 0; i < n; i++) { cout << vote[i] << endl; } } // minority winner boundary for (int c = 0; c < 5; c++) { int win = rand_int(0, n-1); int vote[10]; int total = 0; for (int i = 0; i < n; i++) { vote[i] = (i == win) ? 0 : rand_int(1, 100); total += vote[i]; } vote[win] = min(total, *max_element(vote, vote+n)+10); cout << n << endl; for (int i = 0; i < n; i++) { cout << vote[i] << endl; } } } return 0; }