mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
f062b85fe4
commit
ca73bb7c70
69
S2OJ/965/965.cpp
Normal file
69
S2OJ/965/965.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = (18 << 1) + 5;
|
||||
|
||||
int n;
|
||||
long long ans;
|
||||
bool vis[N];
|
||||
std::string s;
|
||||
std::unordered_map<std::string, int> map;
|
||||
|
||||
void dfs1(int x) {
|
||||
if (x == n + 1) {
|
||||
std::string s1, s2;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
(vis[i] ? s2 : s1).push_back(s[i]);
|
||||
}
|
||||
|
||||
map[s1 + ' ' + s2]++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dfs1(x + 1);
|
||||
vis[x] = true;
|
||||
dfs1(x + 1);
|
||||
vis[x] = false;
|
||||
}
|
||||
|
||||
void dfs2(int x) {
|
||||
if (x == n * 2 + 1) {
|
||||
std::string s1, s2;
|
||||
|
||||
for (int i = n + n; i > n; i--) {
|
||||
(vis[i] ? s2 : s1).push_back(s[i]);
|
||||
}
|
||||
|
||||
ans += map[s1 + ' ' + s2];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dfs2(x + 1);
|
||||
vis[x] = true;
|
||||
dfs2(x + 1);
|
||||
vis[x] = false;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> s;
|
||||
|
||||
s = ' ' + s;
|
||||
|
||||
dfs1(1);
|
||||
dfs2(n + 1);
|
||||
|
||||
cout << (ans >> 1) << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/965/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string11.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string12.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string13.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string14.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string15.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string16.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string17.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string18.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string19.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string20.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string21.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string22.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string23.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string24.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string25.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/965/data/string9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/965/data/string9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user