이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define sz(x) ((int)x.size())
using namespace std;
int n = 1;
vector<int> lr{1};
vector<pair<int, int>> fp;
void add3(int x) {
	fp.push_back({1, ++n});
	fp.push_back({1, ++n});
	fp.push_back({1, ++n});
	for(int i = 1; i < x; ++i) {
		n += 3;
		for(int i = 0; i < 3; ++i) {
			for(int j = 0; j < 3; ++j) {
				fp.push_back({n - 3 - i, n - j});
			}
		}
	}
	lr.push_back(n - 0);
	lr.push_back(n - 1);
	lr.push_back(n - 2);
}
void add1() {
	fp.push_back({1, ++n});
	lr.push_back(n);
}
void sub1() {
	fp.push_back({1, ++n});
	fp.push_back({1, ++n});
	n += 3;
	for(int i = 0; i < 2; ++i) {
		for(int j = 0; j < 3; ++j) {
			fp.push_back({n - 3 - i, n - j});
		}
	}
	lr.push_back(n - 0);
	lr.push_back(n - 1);
	lr.push_back(n - 2);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	long long x = 3;
	vector<pair<long long, int>> v[2];
	for(int i = 1; i <= 60; ++i) {
		v[x > 0].push_back({x, i});
		x = - x * 2 + 3;
	}
	long long k;
	cin >> k; ++k;
	int a = 1;
	if(k < 0) a = 0;
	for(int i = sz(v[a]) - 1; i >= 0; --i) {
		long long x = v[a][i].first;
		int y = v[a][i].second;
		while(abs(x) <= abs(k)) {
			k -= x;
			add3(y);
		}
	}
	while(k) {
		if(k > 0) --k, add1();
		else ++k, sub1();
	}
	++n;
	for(int i = 0; i < sz(lr); ++i) {
		fp.push_back({lr[i], n});
	}
	cout << n << " " << sz(fp) << "\n";
	for(int i = 0; i < sz(fp); ++i) {
		cout << fp[i].first << " " << fp[i].second << "\n";
	}
	return 0;
}
| # | 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... |