mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
parent
5c67779848
commit
8aae6bb15a
67
S2OJ/1695/1695.cpp
Normal file
67
S2OJ/1695/1695.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
#include <iostream>
|
||||
#include <bitset>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 15 + 1,
|
||||
M = 2e6 + 5;
|
||||
|
||||
int n, cnt, a[M], op[M];
|
||||
std::string s;
|
||||
std::bitset<1 << N> g, h[1 << N][2], b, b0, b1, ans;
|
||||
|
||||
inline int get(std::string s) {
|
||||
int x = 0;
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
if (isdigit(s[i])) {
|
||||
x = (x << 1) + (x << 3) + (s[i] - '0');
|
||||
}
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> s;
|
||||
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
g.set(i, s[i] == '1');
|
||||
}
|
||||
|
||||
int f = 1;
|
||||
while (cin >> s, s != "END") {
|
||||
if (s == "N") f = -f;
|
||||
else if (s == "A") op[cnt] = 1;
|
||||
else if (s == "O") op[cnt] = 0;
|
||||
else if (s[0] == 'a') a[++cnt] = f * get(s), f = 1;
|
||||
else a[++cnt] = f * 1e6 * (s == "1" ? 1 : -1), f = 1;
|
||||
}
|
||||
|
||||
for (int s = 0; s < 1 << n; s++) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
h[i][(s >> i) & 1].set(s);
|
||||
}
|
||||
}
|
||||
|
||||
b.set();
|
||||
for (int i = 0; i < 1 << n; i++) b1.set(i);
|
||||
std::bitset<1 << N> sum = b;
|
||||
|
||||
for (int i = 1; i <= cnt; i++) {
|
||||
if (a[i] == -1e6) sum &= b0;
|
||||
else if (a[i] == 1e6) sum &= b1;
|
||||
else if (a[i] > 0) sum &= h[n - a[i]][1];
|
||||
else sum &= h[n + a[i]][0];
|
||||
if (!op[i]) ans |= sum, sum = b;
|
||||
}
|
||||
|
||||
cout << (ans == g ? "YES" : "NO") << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1695/data/bool1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool11.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool12.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool13.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool14.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool15.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool16.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool17.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool18.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool19.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool20.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool21.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool22.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool23.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool24.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool25.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool26.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool27.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool28.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool29.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool30.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool31.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool32.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool32.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool33.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool33.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool34.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool34.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool35.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool35.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool36.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool36.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool37.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool37.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool37.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool38.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool38.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool38.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool39.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool39.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool39.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool40.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool40.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool40.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool41.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool41.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool41.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool42.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool42.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool42.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool42.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool43.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool43.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool43.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool43.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool44.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool44.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool44.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool44.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool45.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool45.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool45.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool45.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool46.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool46.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool46.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool46.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool47.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool47.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool47.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool47.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool48.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool48.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool48.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool48.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool49.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool49.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool49.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool49.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/bool9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/bool9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1695/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1695/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user