-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugging.cpp
More file actions
46 lines (33 loc) · 944 Bytes
/
Debugging.cpp
File metadata and controls
46 lines (33 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <bits/stdc++.h>
using namespace std;
int main() {
#ifndef ONLINE_JUDGE
//input.txt
freopen("input1.txt", "r", stdin);
//output.txt
freopen("output1.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
// stress testing
//understand how to generate the test cases
//wap to find the second largest number in the array
// constraints
// 1 <= T <= 10
// 1 <= N <= 10 ^ 5
// 1 <= a[i] <= 10 ^ 6
// rand() % 10 -> {0, 1, 2, ... 9}
// to generate the test cases
// the way you want output to be just keep the printing statement like it
srand(time(NULL)); // the value will not be seeded..to avoid to generate the same value
int t = rand() % 2 + 1;
cout << t << endl;
while (t--) {
int n = rand() % 5 + 1;
cout << n << endl;
for (int i = 0; i < n; i++) {
cout << (rand() % 6 + 1) << " ";
}
cout << endl;
}
}