結果

問題 No.2198 Concon Substrings (COuNt-CONstruct Version)
ユーザー umezo
提出日時 2023-01-31 07:59:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 225 ms / 2,000 ms
コード長 1,184 bytes
コンパイル時間 1,876 ms
コンパイル使用メモリ 197,688 KB
最終ジャッジ日時 2025-02-10 07:54:34
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 104
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll m;
cin>>m;
if(m<=60000){
cout<<"co";
rep(i,m) cout<<"n";
cout<<endl;
return 0;
}
vector<ll> A(10010);
rep(i,10010) A[i]=(ll)i*i*i;
auto it=lower_bound(ALL(A),m)-A.begin();
if(A[it]==m){
rep(i,it) cout<<"c";
rep(i,it) cout<<"o";
rep(i,it) cout<<"n";
cout<<endl;
return 0;
}
ll l=it-500,r=it+500;
for(ll c=max(1LL,l);c<=r;c++){
for(ll o=max(1LL,l);o<=r;o++){
for(ll n=max(1LL,l);n<=r;n++){
if(c*o*n==m && c+o+n<=60000){
rep(i,c) cout<<"c";
rep(i,o) cout<<"o";
rep(i,n) cout<<"n";
cout<<endl;
return 0;
}
ll c2=m-c*o*n-c*o-c;
if(c2<1) continue;
if(c+o+n+c2+2<=60000){
rep(i,c) cout<<"c";
rep(i,o) cout<<"o";
rep(i,n) cout<<"n";
rep(i,c2) cout<<"c";
cout<<"on";
cout<<endl;
return 0;
}
}
}
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0