結果
問題 |
No.1740 Alone 'a'
|
ユーザー |
|
提出日時 | 2021-11-12 21:34:57 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 432 bytes |
コンパイル時間 | 479 ms |
コンパイル使用メモリ | 67,992 KB |
実行使用メモリ | 7,880 KB |
最終ジャッジ日時 | 2024-11-25 17:20:01 |
合計ジャッジ時間 | 2,310 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 37 WA * 1 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 8 | main() | ^~~~
ソースコード
#include<iostream> #include<atcoder/modint> using namespace std; using mint=atcoder::modint998244353; int N; string S; mint dp[2<<17][2][2]; main() { cin>>N>>S; dp[0][0][0]=1; for(int i=0;i<N;i++) { char c=S[i]; for(int j=0;j<2;j++)for(int k=0;k<2;k++) { char lim=j?'z':c; for(char t=k?'b':'a';t<=lim;t++) { dp[i+1][j|t<lim][k|t=='a']+=dp[i][j][k]; } } } cout<<(dp[N][0][1]+dp[N][1][1]).val()<<endl; }