結果
問題 |
No.145 yukiover
|
ユーザー |
|
提出日時 | 2021-09-23 01:56:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 439 bytes |
コンパイル時間 | 1,493 ms |
コンパイル使用メモリ | 167,568 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 09:22:47 |
合計ジャッジ時間 | 2,284 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; int n,t[26],ans; string s,y="yuki"; bool dfs(string u,int d){ if(u>y)return true; for(char c=(d<4?y[d]:'a');c<=(d?y[d-1]:'z');c++){ if(t[c-'a']){ t[c-'a']--; if(dfs(u+c,d+1))return true; t[c-'a']++; } } return false; } int main(){ cin>>n>>s; while(n--)t[s[n]-'a']++; while(dfs("",0))ans++; cout<<ans<<endl; }