結果

問題 No.2929 Miracle Branch
ユーザー a1048576a1048576
提出日時 2024-10-12 16:27:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 823 bytes
コンパイル時間 1,430 ms
コンパイル使用メモリ 172,152 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 16:27:49
合計ジャッジ時間 10,448 ms
ジャッジサーバーID
(参考情報)
judge / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 4 ms
6,820 KB
testcase_02 AC 4 ms
6,820 KB
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 -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 6 ms
6,816 KB
testcase_19 AC 7 ms
6,820 KB
testcase_20 AC 9 ms
6,816 KB
testcase_21 AC 15 ms
6,816 KB
testcase_22 WA -
testcase_23 AC 25 ms
6,816 KB
testcase_24 AC 76 ms
6,816 KB
testcase_25 WA -
testcase_26 AC 4 ms
6,816 KB
testcase_27 AC 5 ms
6,816 KB
testcase_28 AC 4 ms
6,816 KB
testcase_29 AC 4 ms
6,816 KB
testcase_30 AC 4 ms
6,816 KB
testcase_31 AC 4 ms
6,816 KB
testcase_32 AC 3 ms
6,820 KB
testcase_33 AC 4 ms
6,820 KB
testcase_34 AC 258 ms
6,816 KB
testcase_35 AC 268 ms
5,248 KB
testcase_36 AC 4 ms
5,248 KB
testcase_37 AC 241 ms
5,248 KB
testcase_38 AC 265 ms
5,248 KB
testcase_39 AC 244 ms
5,248 KB
testcase_40 AC 258 ms
5,248 KB
testcase_41 AC 273 ms
5,248 KB
testcase_42 AC 245 ms
5,248 KB
testcase_43 AC 254 ms
5,248 KB
testcase_44 AC 253 ms
6,816 KB
testcase_45 AC 4 ms
6,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
	int n;
	cin >> n;
	if(n == 1) {
		cout << 2 << endl;
		cout << 1 << ' ' << 2 << endl;
		cout << 'b' << ' ' << 'g' << endl;
		return 0;
	}
	vector<int> s;
	for(int i = 2; i <= 200000; i++) while(n%i == 0) {
		n/=i;
		s.push_back(i);
	}
	if(n != 1) {
		cout << -1 << endl;
		return 0;
	}
	int m = 0;
	int l = s.size();
	for(int i = 0; i < l; i++) m+=s[i];
	if(l+m > 200000) {
		cout << -1 << endl;
		return 0;
	}
	cout << m+l << endl;
	for(int i = 0; i < l-1; i++) cout << i+1 << ' ' << i+2 << endl;
	int e = l;
	for(int i = 0; i < l; i++) {
		for(int j = 0; j < s[i]; j++) {
			cout << i+1 << ' ' << e+1 << endl;
			e++;
		}
	}
	for(int i = 0; i < l; i++) cout << 'b' << ' ';
	for(int i = 0; i < m; i++) cout << 'g' << ' ';
	cout << endl;
}
0