-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathtesting_format.cpp
More file actions
65 lines (47 loc) · 1.57 KB
/
testing_format.cpp
File metadata and controls
65 lines (47 loc) · 1.57 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int MOD = 1e9 + 7;
#define show(arr) \
{ \
for (auto x : arr) \
cout << x << " "; \
cout << '\n'; \
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int randNo(int lower_limit, int upper_limit) {
return lower_limit + rng() % (upper_limit - lower_limit);
}
int solve(int arr[], int n) {
int ans = 0;
// write here your optimed code with low complexity
return ans;
}
int solve2(int arr[], int n) {
int ans = 0;
// write here your brute force solution
return ans;
}
int32_t main() {
int testCases = 1000000;
while (testCases--) {
// generating n
int n = randNo(1, 100);
// To generate a random array
int a[n];
for (int i = 0; i < n; i++)
a[i] = randNo(1, N);
int naive_ans = solve2(a, n);
int optimised_ans = solve(a, n);
if (naive_ans == optimised_ans)
cout << "YES\n";
else {
cout << "NO\n";
cout << n << '\n';
show(a);
cout << naive_ans << '\n';
cout << optimised_ans << '\n';
break;
}
}
}