제출 #1142781

#제출 시각아이디문제언어결과실행 시간메모리
1142781antonnCrossing (JOI21_crossing)C++20
26 / 100
7056 ms2288 KiB
#include <bits/stdc++.h> #define F first #define S second using namespace std; using ll = long long; using pi = pair<int, int>; using vi = vector<int>; template<class T> bool ckmin(T& a, T b) { return b < a ? a = b, true : false; } template<class T> bool ckmax(T& a, T b) { return a < b ? a = b, true : false; } set<string> v; string cross(string a, string b) { string c = a; for (int i = 0; i < a.size(); ++i) { if (a[i] == b[i]) c[i] = a[i]; else c[i] = a[i] ^ b[i] ^ 'J' ^ 'O' ^ 'I'; } return c; } void bkt(string s) { for (auto x : v) { if (!v.count(cross(x, s))) { v.insert(cross(x, s)); // cout << cross(x, s) << "\n"; bkt(cross(x, s)); } } } string check(string t) { bool ok = 0; for (auto x : v) { if (x == t) { ok = 1; } } return (ok ? "Yes" : "No"); } int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; string a, b, c; cin >> a >> b >> c; v.insert(a); v.insert(b); v.insert(c); bkt(a); bkt(b); bkt(c); int q; cin >> q; string t; cin >> t; cout << check(t) << "\n"; for (int i = 1; i <= q; ++i) { int l, r; char c; cin >> l >> r >> c; --l; --r; for (int j = l; j <= r; ++j) t[j] = c; cout << check(t) << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...