forked from MikeMirzayanov/testlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aaf8633
commit 6be6702
Showing
7 changed files
with
222 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include "testlib.h" | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
#include <fstream> | ||
#include <iomanip> | ||
#include <string> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <cstring> | ||
#include <cmath> | ||
#include <ctime> | ||
#include <climits> | ||
#include <cassert> | ||
#include <vector> | ||
#include <queue> | ||
#include <stack> | ||
#include <deque> | ||
#include <set> | ||
#include <map> | ||
#include <bitset> | ||
#include <utility> | ||
#include <algorithm> | ||
|
||
#define forn(i, n) for (int i = 0; i < int(n); i++) | ||
|
||
using namespace std; | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
registerGen(argc, argv, 1); | ||
|
||
int n = atoi(argv[1]); | ||
int m = atoi(argv[2]); | ||
size_t k = atoi(argv[3]); | ||
|
||
int t = rnd.next(-2, 2); | ||
|
||
set<pair<int,int> > edges; | ||
|
||
while (edges.size() < k) | ||
{ | ||
int a = rnd.wnext(n, t); | ||
int b = rnd.wnext(m, t); | ||
edges.insert(make_pair(a, b)); | ||
} | ||
|
||
vector<pair<int,int> > e(edges.begin(), edges.end()); | ||
shuffle(e.begin(), e.end()); | ||
|
||
vector<int> pa(n); | ||
for (int i = 0; i < n; i++) | ||
pa[i] = i + 1; | ||
shuffle(pa.begin(), pa.end()); | ||
|
||
vector<int> pb(m); | ||
for (int i = 0; i < m; i++) | ||
pb[i] = i + 1; | ||
shuffle(pb.begin(), pb.end()); | ||
|
||
cout << n << " " << m << " " << e.size() << endl; | ||
|
||
forn(i, e.size()) | ||
cout << pa[e[i].first] << " " << pb[e[i].second] << endl; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "testlib.h" | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
#include <fstream> | ||
#include <iomanip> | ||
#include <string> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <cstring> | ||
#include <cmath> | ||
#include <ctime> | ||
#include <climits> | ||
#include <cassert> | ||
#include <vector> | ||
#include <queue> | ||
#include <stack> | ||
#include <deque> | ||
#include <set> | ||
#include <map> | ||
#include <bitset> | ||
#include <utility> | ||
#include <algorithm> | ||
|
||
#define forn(i, n) for (int i = 0; i < int(n); i++) | ||
|
||
using namespace std; | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
registerGen(argc, argv); | ||
|
||
int n = atoi(argv[1]); | ||
int t = atoi(argv[2]); | ||
|
||
vector<int> p(n); | ||
forn(i, n) | ||
if (i > 0) | ||
p[i] = rnd.wnext(i, t); | ||
|
||
printf("%d\n", n); | ||
vector<int> perm(n); | ||
forn(i, n) | ||
perm[i] = i; | ||
shuffle(perm.begin() + 1, perm.end()); | ||
|
||
vector<int> pp(n); | ||
for (int i = 1; i < n; i++) | ||
pp[perm[i]] = perm[p[i]]; | ||
|
||
for (int i = 1; i < n; i++) | ||
{ | ||
printf("%d", pp[i] + 1); | ||
if (i + 1 < n) | ||
printf(" "); | ||
} | ||
printf("\n"); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "testlib.h" | ||
|
||
#include <iostream> | ||
#include <sstream> | ||
#include <fstream> | ||
#include <iomanip> | ||
#include <string> | ||
#include <cstdlib> | ||
#include <cstdio> | ||
#include <cstring> | ||
#include <cmath> | ||
#include <ctime> | ||
#include <climits> | ||
#include <cassert> | ||
#include <vector> | ||
#include <queue> | ||
#include <stack> | ||
#include <deque> | ||
#include <set> | ||
#include <map> | ||
#include <bitset> | ||
#include <utility> | ||
#include <algorithm> | ||
|
||
#define forn(i, n) for (int i = 0; i < int(n); i++) | ||
|
||
using namespace std; | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
registerGen(argc, argv, 1); | ||
|
||
int n = atoi(argv[1]); | ||
int t = atoi(argv[2]); | ||
|
||
vector<int> p(n); | ||
forn(i, n) | ||
if (i > 0) | ||
p[i] = rnd.wnext(i, t); | ||
|
||
printf("%d\n", n); | ||
vector<int> perm(n); | ||
forn(i, n) | ||
perm[i] = i; | ||
shuffle(perm.begin() + 1, perm.end()); | ||
vector<pair<int,int> > edges; | ||
|
||
for (int i = 1; i < n; i++) | ||
if (rnd.next(2)) | ||
edges.push_back(make_pair(perm[i], perm[p[i]])); | ||
else | ||
edges.push_back(make_pair(perm[p[i]], perm[i])); | ||
|
||
shuffle(edges.begin(), edges.end()); | ||
|
||
for (int i = 0; i + 1 < n; i++) | ||
printf("%d %d\n", edges[i].first + 1, edges[i].second + 1); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "testlib.h" | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int main(int argc, char* argv[]) | ||
{ | ||
setName("Interactor A+B"); | ||
registerInteraction(argc, argv); | ||
|
||
// reads number of queries from test (input) file | ||
int n = inf.readInt(); | ||
for (int i = 0; i < n; i++) | ||
{ | ||
// reads query from test (input) file | ||
int a = inf.readInt(); | ||
int b = inf.readInt(); | ||
|
||
// writes query to the solution, endl makes flush | ||
cout << a << " " << b << endl; | ||
|
||
// writes output file to be verified by checker later | ||
tout << ouf.readInt() << endl; | ||
} | ||
|
||
// just message | ||
quitf(_ok, "%d queries processed", n); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters