結果
問題 |
No.2929 Miracle Branch
|
ユーザー |
|
提出日時 | 2024-10-20 12:43:16 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 880 bytes |
コンパイル時間 | 2,209 ms |
コンパイル使用メモリ | 197,312 KB |
最終ジャッジ日時 | 2025-02-24 21:47:53 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 8 WA * 35 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll=long long; constexpr int MOD=998244353; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define rep2(i,l,r) for(int i=(l);i<(int)(r);i++) #define all(v) v.begin(),v.end() constexpr int MAX_D=200000; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); ll X; cin>>X; vector d(0,0ll); rep2(i,3,MAX_D){ while(X%i==0){ d.push_back(i); X/=i; } } if(X!=1)d.push_back(X); if(d.empty())d.push_back(1); ll s=accumulate(all(d),0ll); if(s+d.size()>MAX_D){ cout<<"-1\n"; return 0; } cout<<s+d.size()<<'\n'; rep(i,d.size()-1){ cout<<i+1<<' '<<i+2<<'\n'; } int cnt=d.size(); rep(i,d.size()){ rep(j,d[i]){ cnt++; cout<<i+1<<' '<<cnt<<'\n'; } } rep(i,d.size()){ if(i)cout<<' '; cout<<'d'; } rep(i,s){ cout<<" g"; } cout<<'\n'; }