結果

問題 No.2198 Concon Substrings (COuNt-CONstruct Version)
ユーザー 沙耶花
提出日時 2023-01-20 21:37:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 828 bytes
コンパイル時間 3,404 ms
コンパイル使用メモリ 251,748 KB
最終ジャッジ日時 2025-02-10 04:32:38
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 104
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001



int main(){
	
	string s = "co";
	rep(i,10000)s += 'c';
	rep(i,10000)s += 'o';
	
	long long M;
	cin>>M;
	
	vector<long long> pos(s.size()+1,0);
	long long x = 0,y = 0;
	rep(i,s.size()){
		if(s[i]=='c')x++;
		else{
			y += x;
		}
		pos[i+1] = y;
	}
	cout<<pos[2]<<endl;
	//cout<<x<<','<<y<<endl;
	vector<int> cnt(s.size()+1,0);
	for(int i=s.size();i>=0;i--){
		//cout<<M<<endl;
		while(M!=0 && M>=pos[i]){
			cnt[i]++;
			M -= pos[i];
		}
	}
	//cout<<M<<endl;
	string ans = "";
	rep(i,s.size()){
		ans += s[i];
		rep(j,cnt[i+1])ans += 'n';
	}
	
	cout<<ans<<endl;
	
	return 0;
}
0