結果

問題 No.1504 ヌメロニム
ユーザー kotatsugamekotatsugame
提出日時 2021-05-08 01:51:52
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 1,833 ms
コンパイル使用メモリ 111,944 KB
実行使用メモリ 24,180 KB
最終ジャッジ日時 2023-10-13 17:48:16
合計ジャッジ時間 8,580 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 1 ms
4,356 KB
testcase_09 AC 1 ms
4,352 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,352 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 1 ms
4,352 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 ms
4,352 KB
testcase_19 AC 2 ms
4,352 KB
testcase_20 AC 3 ms
4,356 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,352 KB
testcase_23 AC 1 ms
4,352 KB
testcase_24 AC 145 ms
23,160 KB
testcase_25 AC 81 ms
15,176 KB
testcase_26 AC 146 ms
23,888 KB
testcase_27 AC 78 ms
16,428 KB
testcase_28 AC 81 ms
16,324 KB
testcase_29 AC 153 ms
23,644 KB
testcase_30 AC 147 ms
23,604 KB
testcase_31 AC 78 ms
15,552 KB
testcase_32 AC 79 ms
16,248 KB
testcase_33 AC 147 ms
23,516 KB
testcase_34 AC 20 ms
6,388 KB
testcase_35 AC 19 ms
5,704 KB
testcase_36 AC 75 ms
13,316 KB
testcase_37 AC 10 ms
4,712 KB
testcase_38 AC 150 ms
24,036 KB
testcase_39 AC 147 ms
23,964 KB
testcase_40 AC 146 ms
24,180 KB
testcase_41 AC 144 ms
23,908 KB
testcase_42 AC 144 ms
23,920 KB
testcase_43 AC 144 ms
23,936 KB
testcase_44 AC 148 ms
24,036 KB
testcase_45 AC 146 ms
24,036 KB
testcase_46 AC 144 ms
23,976 KB
testcase_47 AC 154 ms
23,904 KB
testcase_48 AC 77 ms
15,620 KB
testcase_49 AC 77 ms
15,244 KB
testcase_50 AC 3 ms
4,372 KB
testcase_51 AC 1 ms
4,352 KB
testcase_52 AC 1 ms
4,352 KB
testcase_53 AC 2 ms
4,352 KB
testcase_54 AC 1 ms
4,348 KB
testcase_55 AC 19 ms
5,792 KB
testcase_56 AC 2 ms
4,348 KB
testcase_57 AC 1 ms
4,348 KB
testcase_58 AC 1 ms
4,352 KB
testcase_59 AC 1 ms
4,348 KB
testcase_60 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/modint>
#include<atcoder/convolution>
using namespace std;
using mint=atcoder::modint998244353;
int N;
string S;
main()
{
	cin>>N>>S;
	vector<mint>I(N),J(N);
	for(int i=0;i<N;i++)
	{
		if(S[i]=='i')I[N-i-1]=1;
		else J[i]=1;
	}
	vector<mint>K=convolution(I,J);
	vector<mint>A(N-1);
	mint p=1;
	for(int i=0;i<N-1;i++)
	{
		A[i]=K[N+i]*p;
		p*=i+1;
	}
	vector<mint>B(N-1);
	vector<mint>inv(N-1);
	p=1/p;
	for(int i=N-2;i>=0;i--)
	{
		B[N-2-i]=p*=i+1;
		inv[i]=p;
	}
	vector<mint>C=convolution(A,B);
	int ans=0;
	for(int k=0;k<N-1;k++)
	{
		ans^=(C[N-2+k]*inv[k]).val();
	}
	cout<<ans<<endl;
}
0