結果
問題 | No.3110 Like CPCTF? |
ユーザー |
|
提出日時 | 2025-03-19 20:55:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 856 bytes |
コンパイル時間 | 1,902 ms |
コンパイル使用メモリ | 198,724 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-18 19:30:07 |
合計ジャッジ時間 | 2,712 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; string s; cin >> n >> s; ll ans = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { for (int k = j + 1; k < n; k++) { for (int l = k + 1; l < n; l++) { for (int m = l + 1; m < n; m++) { set<char> t; t.insert(s[i]); t.insert(s[j]); t.insert(s[k]); t.insert(s[l]); t.insert(s[m]); if (s[i] == s[k] && t.size() == 4) { ans++; } } } } } } cout << ans << endl; }