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>
#define pb push_back
#define int int64_t
using namespace std;
constexpr static int MXLOG = 31;
int32_t main()
{
int k;
cin >> k;
vector<int> v;
int nxt = 0;
v.pb(nxt++);
vector<array<int, 2>> e;
for (int i = 1; i < MXLOG; i++)
{
e.pb({v.back(), nxt++});
e.pb({v.back(), nxt++});
e.pb({nxt-2, nxt});
e.pb({nxt-1, nxt});
v.pb(nxt++);
}
for (int i = 0; i < MXLOG; i++)
if ((static_cast<int>(1)<<i)&abs(k))
e.pb({v[i], nxt});
nxt++;
if (k < 0)
{
e.pb({nxt-1, nxt});
nxt++;
}
cout << nxt << " " << e.size() << "\n";
for (auto [a, b] : e)
cout << (a+1) << " " << (b+1) << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |