-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestcse_generator.cpp
100 lines (68 loc) · 1.45 KB
/
testcse_generator.cpp
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <bits/stdc++.h>
using namespace std;
int rand(int l, int r){
static mt19937
rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_int_distribution<int> ludo(l, r);
return ludo(rng);
}
void solve()
{
// just write ur code here
int n;
cin >> n;
cout << n+1 << endl;
}
void generate_testcase(int limit)
{
// generate testcases
int n;
n = rand()%limit;
cout<<n<<endl;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// small cases
for(int i = 0 ; i <= 9 ; i ++)
{
string inpfile = "input0";
inpfile += to_string(i);
inpfile += ".txt";
#ifndef ONLINE_JUDGE
freopen(inpfile.c_str() , "w" , stdout);
#endif
generate_testcase(100);
cout.flush();
string outfile = "output0";
outfile += to_string(i);
outfile += ".txt";
#ifndef ONLINE_JUDGE
freopen(inpfile.c_str() , "r" , stdin);
freopen(outfile.c_str() , "w" , stdout);
#endif
solve();
cout.flush();
}
// large cases
for(int i = 10 ; i <= 20 ; i ++)
{
string inpfile = "input";
inpfile += to_string(i);
inpfile += ".txt";
#ifndef ONLINE_JUDGE
freopen(inpfile.c_str() , "w" , stdout);
#endif
generate_testcase(10000000);
cout.flush();
string outfile = "output";
outfile += to_string(i);
outfile += ".txt";
#ifndef ONLINE_JUDGE
freopen(inpfile.c_str() , "r" , stdin);
freopen(outfile.c_str() , "w" , stdout);
#endif
solve();
cout.flush();
}
return 0;
}