結果

問題 No.3110 Like CPCTF?
ユーザー Ryoga.exe
提出日時 2025-04-19 03:06:32
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,111 bytes
コンパイル時間 1,011 ms
コンパイル使用メモリ 94,392 KB
実行使用メモリ 33,640 KB
最終ジャッジ日時 2025-04-19 03:06:39
合計ジャッジ時間 6,025 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 6 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdlib>
#include <iostream>
#include <string>
#include <unordered_set>

int main() {
    int n;
    std::string s;
    std::cin >> n >> s;
    std::unordered_set<std::string> cpctf;
    for (char a = 'A'; a <= 'Z'; a++) {
        for (char b = 'A'; b <= 'Z'; b++) {
            if (b == a) {
                continue;
            }
            for (char c = 'A'; c <= 'Z'; c++) {
                if (c == a or c == b) {
                    continue;
                }
                for (char d = 'A'; d <= 'Z'; d++) {
                    if (d == a or d == b or d == c) {
                        continue;
                    }
                    // abacd
                    std::string tmp;
                    tmp += a;
                    tmp += b;
                    tmp += a;
                    tmp += c;
                    tmp += d;
                    cpctf.insert(tmp);
                }
            }
        }
    }
    int ans = 0;
    for (int i = 4; i < s.size(); i++) {
        if (cpctf.contains(s.substr(i - 4, 5))) {
            ans++;
        }
    }
    std::cout << ans;
}
0