結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,436 KB
testcase_01 AC 4 ms
7,448 KB
testcase_02 AC 4 ms
7,460 KB
testcase_03 AC 57 ms
7,572 KB
testcase_04 AC 58 ms
7,568 KB
testcase_05 AC 5 ms
7,636 KB
testcase_06 AC 5 ms
7,512 KB
testcase_07 AC 4 ms
7,508 KB
testcase_08 AC 4 ms
7,500 KB
testcase_09 AC 3 ms
7,460 KB
testcase_10 AC 4 ms
7,500 KB
testcase_11 AC 11 ms
7,580 KB
testcase_12 AC 38 ms
7,632 KB
testcase_13 AC 36 ms
7,648 KB
testcase_14 AC 45 ms
7,676 KB
testcase_15 AC 4 ms
7,564 KB
testcase_16 AC 35 ms
7,628 KB
testcase_17 AC 4 ms
7,736 KB
testcase_18 AC 9 ms
7,544 KB
testcase_19 AC 39 ms
7,628 KB
testcase_20 AC 22 ms
7,620 KB
testcase_21 AC 28 ms
7,860 KB
testcase_22 AC 34 ms
7,616 KB
testcase_23 AC 33 ms
7,632 KB
testcase_24 AC 22 ms
7,624 KB
testcase_25 AC 22 ms
7,700 KB
testcase_26 AC 28 ms
7,628 KB
testcase_27 AC 30 ms
7,864 KB
testcase_28 AC 25 ms
7,596 KB
testcase_29 AC 44 ms
7,636 KB
testcase_30 AC 29 ms
7,584 KB
testcase_31 AC 35 ms
7,568 KB
testcase_32 AC 26 ms
7,568 KB
testcase_33 AC 34 ms
7,676 KB
testcase_34 AC 10 ms
7,580 KB
testcase_35 AC 25 ms
7,660 KB
testcase_36 AC 21 ms
7,636 KB
testcase_37 AC 10 ms
7,560 KB
testcase_38 AC 18 ms
7,632 KB
testcase_39 AC 6 ms
7,532 KB
testcase_40 AC 13 ms
7,540 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][1][1].val()<<endl;
}
0