for (int q = read(); q--; ) { int x = read(); int y = read(); int z = read();
if (x < u0 or x > u1 or y < v0 or y > v1 or z > z0 + h or z < z0) { puts("NO"); } else { puts("YES"); } } }
C. CCPC
Code >folded
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
voidsolve(){ string s; cin >> s;
int a = 0, b = 0; for (auto ch : s) { if (ch == 'C') a++; if (ch == 'P') b++; } if (a < 3or b < 1) { puts("0"); return; } cout << min((a - 1) / 2, b) << '\n'; }
vector<int> a(n + 1); vector<int> b(65, -1); // vector<int> c(65, -1); for (int i = 1; i <= n; i++) { a[i] = read(); }
for (int i = 1; i < n; i++) { for (int j = 60; j >= 0; j--) { int x = a[i] >> j & 1; int y = a[i + 1] >> j & 1;
if (x != y) { int now = x; if (b[j] != -1and b[j] != x) { puts("0"); return; } b[j] = x; break; } } }
// for (int i = 0; i < 60; i++) { // b[i] = b[i] == -1 ? 2 : 1; // cerr << b[i] << " "; // }
// int ans = 1;
// for (int i = 60; i >= 0; i--) { // int x = k >> i & 1; // if (x) { // cout << "i: " << i << '\n'; // int res = 1; // // i - b[i] // if (i - 1 >= 0) // res *= 1LL << (i - b[i - 1]); // // cout << "res: " << res << '\n'; // ans += res; // } // }
vector dp(65, vector<int>(2, -1));
auto dfs = [&](auto&& self, int now, bool f) -> int { if (now == -1) return1; if (~dp[now][f]) return dp[now][f];
int res = 0; int lim = f ? (k >> now & 1) : 1; for (int j = 0; j <= lim; j++) { if (b[now] == -1or b[now] == j) { res += self(self, now - 1, f && (j == lim)); } }
vector<Z> ans(3); int p = 1; for (int k = 0; k < 3; k++) { for (auto c : s) { p = sam.extend(p, c - 'a'); } for (int i = 2; i < sam.size(); i++) { ans[k] += sam.len(i) - sam.len(sam.link(i)); } }