QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#671802 | #1131. Crossing | Wansur# | 0 | 0ms | 0kb | C++23 | 1.8kb | 2024-10-24 14:31:54 | 2024-10-24 14:31:54 |
answer
#include <bits/stdc++.h>
#define ent '\n'
#define int long long
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 12;
const int mod = 998244353;
int p[maxn], s[maxn];
string t;
int n, m, k;
string get(string s, string t) {
string ans = "";
for(int i = 0; i < n; i++) {
if(s[i] == t[i]) {
ans += s[i];
}
else {
ans += 'J' + 'O' + 'I' - s[i] - t[i];
}
}
return ans;
}
void solve() {
string a, b, c;
cin >> n >> a >> b >> c;
map<string, int> was;
was[a] = was[b] = was[c] = 1;
vector<string> v = {a, b, c};
while(true) {
int c = 0;
for(int i = 0; i < v.size(); i++) {
for(int j = i + 1; j < v.size(); j++) {
if(!was[get(v[i], v[j])]) {
v.push_back(get(v[i], v[j]));
c = 1;
was[v.back()] = 1;
break;
}
}
if(c) break;
}
if(!c) break;
}
assert(v.size() > 9);
cin >> m >> t;
auto query = [&]() -> void{
bool fg = 0;
for(auto s : v) {
if(s == t) {
fg = 1;
}
}
if(fg) {
cout << "Yes\n";
}
else {
cout << "No\n";
}
};
query();
while(m--) {
char x;
int l, r;
cin >> l >> r >> x;
l--, r--;
for(int i = l; i <= r; i++) {
t[i] = x;
}
query();
}
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
// cin >> t;
while(t--) {
solve();
}
}
詳細信息
Subtask #1:
score: 0
Runtime Error
Test #1:
score: 0
Runtime Error
input:
80 JJIJOJOJOJIJJIJJIJJIJIIIJIIJIJIJIIIJIJOOIIIJIOIIOJJOOJOJJOJJOOIIOOOOOJIIOIJOJIIJ JJIJOJOJOJIJJIJJIJJIJIIIJIIJIJIJIIIJIJOOIIIJIOIIOJJOOJOJJOJJOOIIOOOOOJIIOIJOJIIJ JJIJOJOJOJIJJIJJIJJIJIIIJIIJIJIJIIIJIJOOIIIJIOIIOJJOOJOJJOJJOOIIOOOOOJIIOIJOJIIJ 185606 IIJJOJIOJOIJIJJJJIOOJIIIIIIJIOIIOJOIJOIJOIJOJOI...
output:
result:
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%