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
| #include <algorithm> #include <iostream> #include <cstdlib> #include <cstdio> #include <vector> #include <ctime> #include <map> using namespace std; typedef pair<int,int> par; map<par,int> mp; vector<par> vec; int rnd(int f){ return (long long)rand()*rand()%f; } int main(){ srand(time(NULL)); for(int i=1; i<999; i++){ int f=rnd(i); vec.push_back(par(f, i)); mp[par(f,i)] = 1; } int tmp=1501-998; while(tmp){ int a=rnd(999), b=rnd(999); if(a>b) swap(a, b); if(mp[par(a,b)]) continue; mp[par(a,b)] = 1; vec.push_back(par(a,b)); tmp--; } cout<<"999 "<<vec.size()<<endl; for(int i=0; i<vec.size(); i++) cout<<vec[i].first<<" "<<vec[i].second<<endl; return 0; }
|