結果
問題 | No.2201 p@$$w0rd |
ユーザー |
|
提出日時 | 2024-03-29 19:23:20 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 860 bytes |
コンパイル時間 | 22,383 ms |
コンパイル使用メモリ | 352,896 KB |
最終ジャッジ日時 | 2025-02-20 14:37:08 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#pragma GCC target("avx2")#pragma GCC optimize("O3")#pragma GCC optimize("unroll-loops")#include<bits/stdc++.h>#include<atcoder/all>using namespace std;using namespace atcoder;using ll=long long;using P=pair<ll,ll>;void IO(){ios::sync_with_stdio(false);std::cin.tie(nullptr);}string s;ll n;ll ans=0;void dfs(ll idx,ll c1,ll c2,ll c3){if(idx==n){if(c1&&c2&&c3){ans++;}return;}if(s[idx]=='l'){dfs(idx+1,c1+1,c2,c3);dfs(idx+1,c1,c2+1,c3);}else if(s[idx]=='o'){dfs(idx+1,c1+1,c2,c3);dfs(idx+1,c1,c2+1,c3);}else if(s[idx]=='a'){dfs(idx+1,c1+1,c2,c3);dfs(idx+1,c1,c2,c3+1);}else if(s[idx]=='s'){dfs(idx+1,c1+1,c2,c3);dfs(idx+1,c1,c2,c3+1);}else{dfs(idx+1,c1+1,c2,c3);}}int main(){IO();cin>>s;n=s.size();dfs(0,0,0,0);cout<<ans<<endl;}