結果

問題 No.2545 Divide by 3
ユーザー Carpenters-CatCarpenters-Cat
提出日時 2023-11-24 22:50:23
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 2,018 ms
コンパイル使用メモリ 207,672 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-24 22:50:28
合計ジャッジ時間 2,922 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
	std::vector<tuple<int, int, int, int>> ans;
	ll iv = 1;
	iv <<= 32;
	iv /= 3;
	ans.emplace_back(0, 1, 1, 2);
	ans.emplace_back(0, 4, 4, 1);
	for (int n = 0; n < 32; n ++) {
		if ((iv >> n) & 1) {
			ans.emplace_back(0, 3, 3, 4);
		}
		ans.emplace_back(0, 4, 4, 4);
	}
	for (int n = 0; n < 32; n ++) {
		ans.emplace_back(1, 3, 3, 0);
	}
	cout << ans.size() << endl;
	for (auto [p, a, b, c] : ans) {
		if (p) {
			printf("div %d %d\n", a, b);
		} else {
			printf("plus %d %d %d\n", a, b, c);
		}
	}
	cout << flush;
}
0