제출 #818596

#제출 시각아이디문제언어결과실행 시간메모리
818596vjudge1Crossing (JOI21_crossing)C++17
26 / 100
7009 ms6836 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int n; string T = "JOI"; string get(string a, string b) { string res; for(int i = 0; i < n; i++) if(a[i] == b[i]) res += a[i]; else { int k = 0; while(T[k] == a[i] || T[k] == b[i]) k++; res += T[k]; } return res; } vector<string> st; bool check(string s) { for(string cur : st) if(cur == s) return 1; return 0; } int main() { ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); cin >> n; string s[3]; cin >> s[0] >> s[1] >> s[2]; st.push_back(s[0]); st.push_back(s[1]); st.push_back(s[2]); st.push_back(get(s[0], s[1])); st.push_back(get(s[0], s[2])); st.push_back(get(s[1], s[2])); st.push_back(get(s[0], get(s[1], s[2]))); st.push_back(get(s[0], get(s[2], s[1]))); st.push_back(get(s[1], get(s[0], s[2]))); st.push_back(get(s[1], get(s[2], s[0]))); st.push_back(get(s[2], get(s[0], s[1]))); st.push_back(get(s[2], get(s[1], s[0]))); int q; cin >> q; string t; cin >> t; cout << (check(t) ? "Yes\n" : "No\n"); while(q--) { int l, r; char x; cin >> l >> r >> x; for(int i = l - 1; i < r; i++) t[i] = x; cout << (check(t) ? "Yes\n" : "No\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...