# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1042854 | ALeonidou | Rail (IOI14_rail) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define F first
#define S second
#define sz(x) (ll)x.size()
#define endl "\n"
#define pb push_back
typedef vector <ll> vi;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
mt19937 rng;
void init_random(){
rng = mt19937(chrono::steady_clock::now().time_since_epoch().count());
}
ll getNum(ll l, ll r){
return (l + rng() % (r-l+1));
}
int main(){
init_random();
ll n = getNum(3,8), r = 10;
vii v;
ll f = getNum(0, r-2);
v.pb(ii(f,1));
ll f2 = getNum(f+1, r-1);
v.pb(ii(f2,2));
set <ll> st;
st.insert(f);
st.insert(f2);
ll miniPos = f;
ll maxPos = f2;
for (ll i =2; i<n; i++){
ll p = getNum(0, r-1);
while (st.find(p) != st.end()) p = getNum(0,r-1);
st.insert(p);
v.pb(ii(p, getNum(1,2)));
miniPos = min(miniPos,p);
maxPos = max(maxPos, p);
}
for (ll i =0; i<n; i++){
if (v[i].F == miniPos) v[i].S = 1;
if (v[i].F == maxPos) v[i].S = 2;
}
cout<<"3"<<endl;
cout<<n<<endl;
for (ll i= 0; i<n; i++){
cout<<v[i].S<<" "<<v[i].F<<endl;
}
}