結果
問題 |
No.145 yukiover
|
ユーザー |
|
提出日時 | 2021-09-23 01:50:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 5,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 1,732 ms |
コンパイル使用メモリ | 167,596 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 09:22:42 |
合計ジャッジ時間 | 2,328 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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']--; u+=c; if(dfs(u,d+1))return true; u.pop_back(); t[c-'a']++; } } return false; } int main(){ cin>>n>>s; while(i<n)t[s[i++]-'a']++; while(dfs("",0))ans++; cout<<ans<<endl; }