結果

問題 No.2198 Concon Substrings (COuNt-CONstruct Version)
ユーザー FplusFplusF
提出日時 2023-01-20 22:39:41
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,540 bytes
コンパイル時間 1,864 ms
コンパイル使用メモリ 205,972 KB
最終ジャッジ日時 2025-02-10 05:08:08
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 27 WA * 40 OLE * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
const ll INF=(1ll<<60);
template<class T> void chmin(T &a,T b){
    if(a>b){
        a=b;
    }
}
template<class T> void chmax(T &a,T b){
    if(a<b){
        a=b;
    }
}
ll modpow(ll a,ll b,ll mod){
    if(b==0) return 1;
    ll p=a,ret=1;
    for(ll i=0;i<=62;i++){
        if(b&(1ll<<i)){
            ret*=p;
            ret%=mod;
        }
        p=(p%mod)*(p%mod);
        p%=mod;
    }
    return ret;
}
int main(){
    ll m;
    cin >> m;
    if(m==0){
        cout << "a" << endl;
    }else{
        map<ll,ll> mp;
        for(ll i=2;i*i<=m;i++){
            if(m%i==0){
                mp[i]++;
                m/=i;
                i=1;
            }
        }
        mp[m]++;
        vector<pll> c,o,n;
        for(auto &[a,b]:mp){
            c.emplace_back(a,b/3);
            b-=b/3;
        }
        for(auto &[a,b]:mp){
            o.emplace_back(a,b/3);
            b-=b/3;
        }
        for(auto &[a,b]:mp){
            n.emplace_back(a,b);
        }
        ll r=1;
        for(auto &[a,b]:c){
            rep(i,b) r*=a;
            
        }
        rep(i,r) cout << "c";
        r=1;
        for(auto &[a,b]:o){
            rep(i,b) r*=a;
        }
        rep(i,r) cout << "o";
        r=1;
        for(auto &[a,b]:n){
            rep(i,b) r*=a;
        }
        rep(i,r) cout << "n";
        cout << endl;
    }
}
0