Submission #594573

#TimeUsernameProblemLanguageResultExecution timeMemory
594573SOCIOPATECrossing (JOI21_crossing)C++17
26 / 100
7081 ms3648 KiB
#include <bits/stdc++.h> #include <iostream> #include <cstdlib> #include <iomanip> #include <vector> #include <cmath> #include <assert.h> #include <ctime> #include <math.h> #include <queue> #include <string> #include <numeric> #include <fstream> #include <set> #include <unordered_map> #include <unordered_set> #include <map> #include <stack> #include <random> #include <list> #include <bitset> #include <algorithm> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef long double ld; typedef unsigned long long ull; #define pll pair<ll, ll> #define pii pair<int, int> #define pdd pair<ld, ld> #define ff first #define ss second #define all(v) v.begin(),v.end() typedef tree< pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ordset; #pragma GCC optimize("-O3") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-Os") ll INF = 2e18; //mt19937 gen(time(0)); ll gcd(ll n, ll m){ while(n != 0 && m != 0){ if(n > m) n %= m; else m %= n; } return n + m; } ll lcm(ll n, ll m){ ll nod = gcd(n, m); return n / nod * m; } ll mod = 1e9 + 7; ll binpow(ll n, ll m){ if(m == 0) return 1; if(m % 2ll == 1) { return (binpow(n, m - 1ll) * 1ll * n) % mod; } ll b = binpow(n, m / 2); return (b * 1ll * b) % mod; } void solve(){ int n; cin >> n; vector<string> a(3); for(int i = 0; i < 3; i++) cin >> a[i]; set<string> st; while(true){ int u = (int)st.size(); int n1 = (int)a.size(); for(int i = 0; i < n1; i++){ for(int j = 0; j < n1; j++){ string s = ""; for(int k = 0; k < n; k++){ if(a[i][k] == a[j][k]) s += a[i][k]; else if (a[i][k] != 'J' && a[j][k] != 'J') s += "J"; else if (a[i][k] != 'O' && a[j][k] != 'O') s += "O"; else if (a[i][k] != 'I' && a[j][k] != 'I') s += "I"; } if(st.count(s)) continue; else{ a.push_back(s); st.insert(s); } } } if(u == (int)st.size()) break; } int q; cin >> q; string s; cin >> s; if(st.count(s)) cout << "Yes\n"; else cout << "No\n"; for(int i = 0; i < q; i++){ int l, r; string t; cin >> l >> r >> t; l--; r--; for(; l <= r; l++) s[l] = t[0]; if(st.count(s)) cout << "Yes\n"; else cout << "No\n"; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int tt; //cin >> tt; tt = 1; while (tt--) { solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...