結果

問題 No.3110 Like CPCTF?
ユーザー mersnn621
提出日時 2025-04-20 16:24:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 776 bytes
コンパイル時間 611 ms
コンパイル使用メモリ 65,116 KB
実行使用メモリ 19,400 KB
最終ジャッジ日時 2025-04-20 16:24:53
合計ジャッジ時間 7,071 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>

int count1 = 0;
void generateSubsequences(const std::string& str, int index, std::string current, int count) {
    if (count == 5) {
    	if(current[0] == current[2] && current[1] != current[2] && current[1] != current[3] && current[1] != current[4] && current[2] != current[3] && current[2] != current[4] && current[3] != current[4]){
    		count1++;
        return;
    	}
    }
    if (index >= str.size()) return;
    generateSubsequences(str, index + 1, current + str[index], count + 1);
    generateSubsequences(str, index + 1, current, count);
}

int main() {
	int n;
	std::cin>>n;
    std::string s;
    std::cin >> s;
    generateSubsequences(s, 0, "", 0);
    std::cout << count1 << std::endl;
    return 0;
}
0