# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1015499 | daffuwu | Crossing (JOI21_crossing) | C++14 | 7092 ms | 5932 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long n, sz, q, l, r;
bool bad;
char ch;
string s[3], cs, t0;
vector<string> ls;
map<string, bool> ex;
char crot(char a, char b)
{
if (a>b) swap(a, b);
if (a == b) return a;
if (a == 'I' && b == 'J') return 'O';
if (a == 'I' && b == 'O') return 'J';
return 'I';
}
string cross(string a, string b)
{
int i;
string c = "";
for (i=0; i<n; i++)
{
c += crot(a[i], b[i]);
}
return c;
}
int main()
{
long long i, j, rr;
scanf("%lld", &n);
cin >> s[0] >> s[1] >> s[2];
ex[s[0]] = ex[s[1]] = ex[s[2]] = 1;
for (auto [ky, _]:ex) ls.push_back(ky);
for (; 1;)
{
sz = ls.size();
bad = 1;
for (i=0; i<sz; i++)
{
for (j=i+1; j<sz; j++)
{
cs = cross(ls[i], ls[j]);
if (!ex.count(cs))
{
ex[cs] = 1;
bad = 0;
i = sz+1;
break;
}
}
}
if (bad) break;
ls.push_back(cs);
}
// printf("terdapat %lld string:\n", (long long)ls.size());
// for (auto el:ls)
// {
// cout << el << "\n";
// }
// printf("crot\n");
scanf("%lld", &q);
for (rr=0; rr<=q; rr++)
{
if (rr == 0) cin >> t0;
else
{
scanf("%lld%lld %c", &l, &r, &ch);
l--;
r--;
for (i=l; i<=r; i++) t0[i] = ch;
}
bad = 1;
for (auto el:ls)
{
if (t0 == el) bad = 0;
}
if (bad) printf("No\n");
else printf("Yes\n");
}
}
Compilation message (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... |