# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
573845 | colossal_pepe | Crossing (JOI21_crossing) | C++17 | 7035 ms | 4604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |