結果

問題 No.1880 Many Ways
ユーザー 👑 colognecologne
提出日時 2022-03-17 16:55:09
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 637 bytes
コンパイル時間 1,163 ms
コンパイル使用メモリ 121,240 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 22:49:36
合計ジャッジ時間 14,446 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <functional>
#include <iostream>
#include <optional>
#include <vector>
#include <atcoder/modint>

using namespace std;

int main()
{
	long long A;
	cin >> A;
	vector<pair<int, int>> V;
	if (A == 0)
	{
		cout << 2 << " " << 0 << endl;
		return 0;
	}
	else if (A == 1)
	{
		cout << 1 << " " << 0 << endl;
		return 0;
	}
	int u = 1, d = 1;
	while (A != 1)
	{
		int nu = u + 2, nd = u + 1;
		V.emplace_back(u, nu);
		V.emplace_back(u, nu);
		V.emplace_back(d, nd);
		if (A & 1)
			V.emplace_back(d, nu);
		A >>= 1;
		u = nu, d = nd;
	}
	cout << u << " " << V.size() << endl;
	for (auto [a, b] : V)
		cout << a << " " << b << endl;
}
0