結果
問題 |
No.145 yukiover
|
ユーザー |
|
提出日時 | 2021-09-23 01:54:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 443 bytes |
コンパイル時間 | 1,445 ms |
コンパイル使用メモリ | 168,644 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 09:22:44 |
合計ジャッジ時間 | 2,294 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
#include<bits/stdc++.h> using namespace std; int n,i,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(i<n)t[s[i++]-'a']++; while(dfs("",0))ans++; cout<<ans<<endl; }