結果
| 問題 |
No.2929 Miracle Branch
|
| コンテスト | |
| ユーザー |
yel_ow
|
| 提出日時 | 2024-11-24 02:57:11 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,536 bytes |
| コンパイル時間 | 2,799 ms |
| コンパイル使用メモリ | 251,384 KB |
| 実行使用メモリ | 9,600 KB |
| 最終ジャッジ日時 | 2024-11-24 02:57:26 |
| 合計ジャッジ時間 | 13,250 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 17 |
ソースコード
//#include <monsterenergy>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int MAX = 1e9;
const int MIN = -1*1e9;
const ll MAXLL = 1e18;
const ll MINLL = -1*1e18;
int main()
{
ll X,Count=0; cin >> X;
if(X == 1)
{
cout << 2 << endl;
cout << 1 << " " << 2 << endl;
cout << "b g" << endl;
return 0;
}
if(X == 4)
{
cout << 5 << endl;
cout << 1 << " " << 2 << endl;
cout << 1 << " " << 3 << endl;
cout << 1 << " " << 4 << endl;
cout << 1 << " " << 5 << endl;
cout << "b g g g g" << endl;
return 0;
}
vector<int> Ans;
for(ll i = 2; i <= 200000; i++)
{
int c = 0;
while(X%i == 0)
{
c++;
X/=i;
Ans.push_back(i);
}
Count += (i+1)*c;
}
if(X != 1 || 200000 < Count)
{
cout << -1 << endl;
return 0;
}
vector<string> Color(Count+1);
cout << Count << endl;
int used = 1, save = -1;
for(int i = 0; i < Ans.size(); i++)
{
Color[used] = "b";
for(int j = 1; j <= Ans[i]; j++)
{
cout << used << " " << used+j << endl;
Color[used+j] = "g";
}
if(save != -1) cout << save << " " << used << endl;
save = used;
used += Ans[i]+1;
}
for(int i = 1; i <= Count; i++)
{
cout << Color[i] << " ";
}
cout << endl;
return 0;
}
yel_ow