Submission #573845

#TimeUsernameProblemLanguageResultExecution timeMemory
573845colossal_pepeCrossing (JOI21_crossing)C++17
26 / 100
7035 ms4604 KiB
#include <iostream> #include <vector> #include <set> using namespace std; int n, q; set<string> dict; vector<string> all, now(3); string t; char crossChar(char c1, char c2) { if (c1 == c2) return c1; if (c1 != 'J' and c2 != 'J') return 'J'; else if (c1 != 'O' and c2 != 'O') return 'O'; else return 'I'; } string crossStr(string s1, string s2) { string ret; for (int i = 0; i < s1.size(); i++) { ret += crossChar(s1[i], s2[i]); } return ret; } void generate() { while (not now.empty()) { string s = now.back(); now.pop_back(); if (dict.find(s) != dict.end()) continue; dict.insert(s); all.push_back(s); for (string t : all) { now.push_back(crossStr(s, t)); } } } bool check() { for (string s : all) { if (t == s) return 1; } return 0; } int main() { cin >> n >> now[0] >> now[1] >> now[2]; generate(); cin >> q >> t; cout << (check() ? "Yes" : "No") << '\n'; while (q--) { int l, r; char c; cin >> l >> r >> c; for (int i = l - 1; i <= r - 1; i++) { t[i] = c; } cout << (check() ? "Yes" : "No") << '\n'; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'std::string crossStr(std::string, std::string)':
Main.cpp:20:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for (int i = 0; i < s1.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...