結果
| 問題 |
No.3110 Like CPCTF?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-20 14:53:11 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 4,416 bytes |
| コンパイル時間 | 2,455 ms |
| コンパイル使用メモリ | 208,268 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-20 14:53:14 |
| 合計ジャッジ時間 | 3,160 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
/* nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
E 3
E Koalas are the CUTEST animals. 3
E 3
uuuuuuuuuuuuuuuuuuuuuuuu uuuuuuu
| /
|/
`-^'-';-. .":^_"":;;^'``...`.-;;":,
_- .__- __~^ '___ '~-_'^^,_,
G .^^`~^~ ._ ^__"` S
v _!- "_~- '^' ."` \`
w _^ ,! .+ "_ ..!`^
_. ,^ = = `= `<
= _^ '" `" 1 >
_ 1 ^; / r ,;
< 1 ! `_ \ =
X ! -' 4 ": _`
5 ., ,3y_ = 4 o ';_
"_ v -Tt' = 4 ^.'_,`
,\ 6 \ ~##v E
5 5 + +1` 1
! v ~. ,
` = \` E
u +! =+ `
', "` -` "' "+++++. + `\ `
! '- ^" `!_ ."-` '"
^ ^ ^". .^-": !- ?
! + .__":_ ._-_,,_` - ^
= ,":_":":_.^^^_,'..-_^^^^_.,~_--__'__ <
= +
`" ".
`\ !.
`
*/
#include<bits/stdc++.h>
using namespace std;
using lnln = long long;
using veci = vector<int>; //二次元はvector<veci>で我慢
using vecl = vector<long long>;
using vecs = vector<string>;
using vecb = vector<bool>;
#define repe(i,n) for(int i = 0; i < (n); ++i) //ただのfor
#define eper(i,n) for(int i = (n)-1; i >= 0; --i) //逆からfor
#define been(a) a.begin(),a.end() //sort(been(A))とかできる
#define neeb(a) a.rbegin(),a.rend() //逆からそれ
#define chax(a,b) a = max(a,b) //answの更新とかに
#define chin(a,b) a = min(a,b) //上に同じく
#define outY cout << "Yes\n" //出力さぼれて嬉しい(要セミコロン)
#define outN cout << "No\n" //上に
#define outM cout << "-1\n" //上に
#define outA(n) cout << (n) << "\n" //上のやつの汎用化した
int yonx[] = {0,1,0,-1}, yony[] = {-1,0,1,0}; //12時から時計回り四近傍
int hatx[] = {0,1,1,1,0,-1,-1,-1}, haty[] = {-1,-1,0,1,1,1,0,-1}; //八近傍
#ifdef __LOCAL //dbgn() -> 改行区切り
#define dbgn(N) cout << (N) << "\n";
#else
#define dbgn(N);
#endif
#ifdef __LOCAL //dbgs() -> 空白区切り
#define dbgs(N) cout << (N) << " ";
#else
#define dbgs(N);
#endif
int main(void)
{
int N;
string S;
cin >> N >> S;
map<char,int> exis;
repe(i,N){
exis[S[i]]++;
}
vector<string> cand;
repe(i,N){
if(2 <= exis[S[i]] and i < N-2){
for(int n = i+1;n < N;n++){
if(S[n] == S[i] and n < N-2){
int star = i+1, fini = n;
if(0 < fini-star){
for(int t = star;t < fini;t++){
for(int e = fini+1;e < N-1;e++){
for(int g = e+1;g < N;g++){
string kouh = "";
kouh += S[i];
kouh += S[t];
kouh += S[n];
kouh += S[e];
kouh += S[g];
cand.push_back(kouh);
}
}
}
}
}
}
}
}
lnln answ = 0;
repe(i,cand.size()){
set<char> dupl;
repe(n,5) dupl.insert(cand[i][n]);
if(dupl.size() == 4) answ++;
}
outA(answ);
return 0;
}