Skip to content

Instantly share code, notes, and snippets.

@xdoju
Created October 30, 2016 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xdoju/85d9b67d9146dc0e0b17b2e918f07e73 to your computer and use it in GitHub Desktop.
Save xdoju/85d9b67d9146dc0e0b17b2e918f07e73 to your computer and use it in GitHub Desktop.
#include <cstdio>
#include <chrono>
#include <random>
using namespace std;
mt19937 R;
bool Svs[1010], Wvs[1010];
int r(int x, int y){ return R() % (y - x + 1) + x; }
int main(){
R.seed(chrono::system_clock::now().time_since_epoch().count());
int N = 100; printf("%d\n", N);
for(; N--; ){
int s = r(1, 1000), w = r(1, 1000);
while(Svs[s] || Wvs[w]){ s = r(1, 1000); w = r(1, 1000); }
printf("%d %d %d\n", s, r(1, 1000), w);
Svs[s] = Wvs[w] = true;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment