結果

問題 No.1740 Alone 'a'
ユーザー kotatsugamekotatsugame
提出日時 2021-11-12 21:34:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 68,612 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2023-08-17 00:12:53
合計ジャッジ時間 2,827 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
7,460 KB
testcase_02 AC 3 ms
7,420 KB
testcase_03 AC 56 ms
7,588 KB
testcase_04 AC 58 ms
7,644 KB
testcase_05 AC 5 ms
7,428 KB
testcase_06 AC 4 ms
7,740 KB
testcase_07 AC 3 ms
7,484 KB
testcase_08 AC 4 ms
7,468 KB
testcase_09 WA -
testcase_10 AC 4 ms
7,420 KB
testcase_11 AC 11 ms
7,576 KB
testcase_12 AC 38 ms
7,544 KB
testcase_13 AC 35 ms
7,652 KB
testcase_14 AC 44 ms
7,548 KB
testcase_15 AC 4 ms
7,480 KB
testcase_16 AC 34 ms
7,588 KB
testcase_17 AC 4 ms
7,464 KB
testcase_18 AC 9 ms
7,528 KB
testcase_19 AC 38 ms
7,592 KB
testcase_20 AC 22 ms
7,592 KB
testcase_21 AC 28 ms
7,612 KB
testcase_22 AC 33 ms
7,560 KB
testcase_23 AC 33 ms
7,548 KB
testcase_24 AC 21 ms
7,732 KB
testcase_25 AC 22 ms
7,592 KB
testcase_26 AC 28 ms
7,612 KB
testcase_27 AC 29 ms
7,736 KB
testcase_28 AC 24 ms
7,736 KB
testcase_29 AC 44 ms
7,852 KB
testcase_30 AC 28 ms
7,552 KB
testcase_31 AC 34 ms
7,600 KB
testcase_32 AC 26 ms
7,652 KB
testcase_33 AC 34 ms
7,668 KB
testcase_34 AC 10 ms
7,512 KB
testcase_35 AC 24 ms
7,596 KB
testcase_36 AC 20 ms
7,600 KB
testcase_37 AC 10 ms
7,520 KB
testcase_38 AC 18 ms
7,588 KB
testcase_39 AC 5 ms
7,512 KB
testcase_40 AC 13 ms
7,564 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#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;
}
0