Submission #680372

#TimeUsernameProblemLanguageResultExecution timeMemory
680372bashkortCrossing (JOI21_crossing)C++17
26 / 100
7034 ms4276 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; string cross(string &a, string &b) { string res(a.size(), 'a'); for (int i = 0; i < a.size(); ++i) { if (a[i] == b[i]) { res[i] = a[i]; } else { res[i] = 'J' ^ 'O' ^ 'I' ^ a[i] ^ b[i]; } } return res; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; string A, B, C; cin >> A >> B >> C; unordered_set<string> every{A, B, C}; queue<string> qu; qu.push(A), qu.push(B), qu.push(C); while (!qu.empty()) { string s = qu.front(); qu.pop(); for (string to : every) { string res = cross(s, to); if (!every.count(res)) { qu.push(res); every.insert(res); } } } int q; cin >> q; string t; cin >> t; cout << (every.count(t) ? "Yes\n" : "No\n"); while (q--) { int l, r; char c; cin >> l >> r >> c; --l; for (int i = l; i < r; ++i) { t[i] = c; } cout << (every.count(t) ? "Yes\n" : "No\n"); } return 0; }

Compilation message (stderr)

Main.cpp: In function 'std::string cross(std::string&, std::string&)':
Main.cpp:8:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for (int i = 0; i < a.size(); ++i) {
      |                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...