0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-10 22:58:47 +00:00

Compare commits

...

2 Commits

53 changed files with 262 additions and 0 deletions

40
Luogu/CF1166E/CF1166E.cpp Normal file
View File

@ -0,0 +1,40 @@
#include <iostream>
#include <bitset>
using std::cin;
using std::cout;
const char endl = '\n';
const int N = 1e4 + 5;
int m, n;
std::bitset<N> s[55];
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> m >> n;
for (int i = 1, k; i <= m; i++) {
cin >> k;
for (int j = 1, x; j <= k; j++) {
cin >> x;
s[i].set(x);
}
for (int j = 1; j < i; j++) {
if (!(s[i] & s[j]).count()) {
cout << "impossible" << endl;
exit(0);
}
}
}
cout << "possible" << endl;
return 0;
}

69
S2OJ/965/965.cpp Normal file
View 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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.

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

Binary file not shown.