結果

問題 No.171 スワップ文字列(Med)
ユーザー 沙耶花沙耶花
提出日時 2021-11-03 16:29:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 7 ms / 1,000 ms
コード長 612 bytes
コンパイル時間 4,652 ms
コンパイル使用メモリ 263,620 KB
実行使用メモリ 7,472 KB
最終ジャッジ日時 2023-08-03 09:07:07
合計ジャッジ時間 6,010 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
7,432 KB
testcase_01 AC 7 ms
7,388 KB
testcase_02 AC 6 ms
7,408 KB
testcase_03 AC 6 ms
7,404 KB
testcase_04 AC 6 ms
7,388 KB
testcase_05 AC 6 ms
7,408 KB
testcase_06 AC 6 ms
7,440 KB
testcase_07 AC 6 ms
7,448 KB
testcase_08 AC 6 ms
7,408 KB
testcase_09 AC 6 ms
7,408 KB
testcase_10 AC 6 ms
7,388 KB
testcase_11 AC 7 ms
7,472 KB
testcase_12 AC 6 ms
7,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 2000000000



int main(){	
	
	mint::set_mod(573);
	vector dp(1005,vector<mint>(1005,0));
	dp[0][0] = 1;
	rep(i,1003){
		rep(j,i+1){
			dp[i+1][j] += dp[i][j];
			dp[i+1][j+1] += dp[i][j];
		}
	}
	
	vector<int> cnt(26,0);
	string s;
	cin>>s;
	int n = s.size();
	rep(i,s.size()){
		cnt[s[i]-'A']++;
	}
	
	mint ans = 1;
	rep(i,26){
		ans *= dp[n][cnt[i]];
		n -= cnt[i];
	}
	ans--;
	cout<<ans.val()<<endl;
	
	return 0;
	
}
0