結果

問題 No.2198 Concon Substrings (COuNt-CONstruct Version)
ユーザー momoyuu
提出日時 2023-05-20 00:47:57
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 654 bytes
コンパイル時間 3,281 ms
コンパイル使用メモリ 247,184 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-21 02:52:28
合計ジャッジ時間 8,343 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 104
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ll m;
    cin>>m;
    vector<char> ans;
    ll a = 10000;
    ll b = 10000;
    ll cnt = 0;
    ll now = 0;
    while(a>0||b>0){
        ll nxt = a * (a+1) / 2;
        while(a&&b&&cnt+nxt<=m){
            cnt += nxt;
            ans.push_back('n');
        }
        if(now==0){
            b--;
            ans.push_back('o');
        }else{
            a--;
            ans.push_back('c');
        }
        now ^= 1;
    }
    reverse(ans.begin(),ans.end());
    assert(cnt==m);
    for(int i = 0;i<ans.size();i++){
        cout<<ans[i];
    }
    cout<<endl;

}



0