結果
| 問題 |
No.2929 Miracle Branch
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 16:37:15 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
OLE
|
| 実行時間 | - |
| コード長 | 1,324 bytes |
| コンパイル時間 | 2,829 ms |
| コンパイル使用メモリ | 249,044 KB |
| 実行使用メモリ | 10,496 KB |
| 最終ジャッジ日時 | 2024-10-12 16:37:22 |
| 合計ジャッジ時間 | 7,161 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 OLE * 1 |
| other | -- * 43 |
ソースコード
typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;
signed main() {
ll x;
std::cin >> x;
ll sum = 0;
if(x==1){
std::cout << 2 << std::endl;
std::cout << "1 2" << std::endl;
std::cout << "b g" << std::endl;
return 0;
}
multiset<ll> ms;
for (ll i = 3; i <= 200000; i++) {
while(x%i==0){
ms.insert(i);
x/=i;
sum += i+1;
}
}
while(x%2==0){
ms.insert(2);
x/=2;
sum += 3;
}
if(sum<=200000){
std::cout << sum << std::endl;
for (int i = 0; i < ms.size()-1; i++) {
std::cout << i+1<<" "<<i+2 << std::endl;
}
ll par = 1;
ll index = ms.size()+1;
for (auto e : ms) {
for (int i = 0; i < e; i++) {
std::cout << par<<" "<<index << std::endl;
index++;
}
par++;
}
for (int i = 0; i < ms.size(); i++) {
std::cout << "b ";
}
for (int i = 0; i < sum-ms.size(); i++) {
std::cout << "g";
if(i<sum-ms.size()-1){
cout<<" ";
}
}
std::cout << std::endl;
}else{
std::cout << -1 << std::endl;
}
}