Submission #845716

# Submission time Handle Problem Language Result Execution time Memory
845716 2023-09-06T15:04:21 Z vjudge1 Konstrukcija (COCI20_konstrukcija) C++17
0 / 110
0 ms 348 KB
#include <bits/stdc++.h>
#define pb push_back
#define int int64_t
using namespace std;

constexpr static int MXLOG = 62;

int32_t main()
{
	int k;
	cin >> k;
	int ccc = (k < 0) ? 0 : 1;
	vector<vector<int>> v;
	vector<array<int, 2>> e;
	int nxt = 1;
	for (int i = 1; i <= 3; i++)
		e.pb({0, nxt++});
	array<int, 3> last = {1, 2, 3};
	if (ccc == 0)
	{
		v.pb({0});
	}
	for (int i = 1; i < MXLOG; i++)
	{
		if (ccc == (i&1))
		{
			vector<int> vv;
			for (int j = 0; j < 2; j++)
				vv.pb(last[j]);
			v.pb(vv);
			vv.clear();
			for (int j = 0; j < 3; j++)
				vv.pb(last[j]);
			v.pb(vv);
		}
		for (int j = 0; j < 3; j++)
			for (int l = 0; l < 3; l++)
				e.pb({last[l], nxt+j});
		for (int j = 0; j < 3; j++)
			last[j] = nxt++;
	}
	k = abs(k);
	for (int i = 0; i < MXLOG; i++)
		if (k&(static_cast<int>(1)<<i))
			for (int j : v[i])
				e.pb({j, nxt});
	nxt++;
	cout << nxt << " " << e.size() << "\n";
	for (auto [a, b] : e)
		cout << (a+1) << " " << (b+1) << "\n";
}

# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong output format.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong output format.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong output format.
2 Halted 0 ms 0 KB -