Submission #855517

#TimeUsernameProblemLanguageResultExecution timeMemory
855517vjudge1Crossing (JOI21_crossing)C++17
26 / 100
7033 ms3028 KiB
#include <bits/stdc++.h> #include <fstream> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/trie_policy.hpp> using namespace __gnu_pbds; using namespace std; template<class A, class B> ostream& operator<<(ostream& o, const pair<A, B>& p) {return o << '(' << p.first << ", " << p.second << ')';} template<size_t Index = 0, typename... Types> ostream& printTupleElements(ostream& o, const tuple<Types...>& t) {if constexpr (Index < sizeof...(Types)){if(Index > 0){o << ", ";}o << get<Index>(t);printTupleElements<Index + 1>(o, t);}return o;} template<typename... Types> ostream& operator<<(ostream& o, const tuple<Types...>& t){o << "(";printTupleElements(o, t);return o << ")";} template<class T> auto operator<<(ostream& o, const T& x) -> decltype(x.end(), o){o << '{';bool first = true;for (const auto& e : x){if (!first){o << ", ";}o << e;first = false;} return o << '}';} #define DEBUG #ifdef DEBUG #define fastio() #define debug(x...) cerr << "[" #x "]: ", [](auto... $) {((cerr << $ << "; "), ...); }(x), cerr << '\n' #define check(x) if (!(x)) { cerr << "Check failed: " << #x << " in line " << __LINE__ << endl; exit(1); } #else #define fastio() ios_base::sync_with_stdio(0); cin.tie(0); #define debug(...) #define check(x) #endif typedef long long ll; #define pi pair<int, int> #define pll pair<ll, ll> #define st first #define nd second #define vi vector<int> #define vll vector<ll> #define eb emplace_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() void wypisz(string a) { for(auto x : a) { cout << x; } cout << '\n'; } vector<char>lit = {'J', 'O', 'I'}; string comb(string a, string b) { string res = ""; for(int i = 0; i < sz(a); i++) { if(a[i] == b[i]) { res += a[i]; } else { for(auto x : lit) { if(x != a[i] && x != b[i]) { res += x; } } } } return res; } void solve() { //ifstream cin("nazwa.in"); //ofstream cout("nazwa.out"); int n; cin >> n; string a, b, c; cin >> a >> b >> c; set<string>kt; for(int mask = 1; mask < (1 << 3); mask++) { vector<string>per; if(mask & (1 << 0)) { per.eb(a); } if(mask & (1 << 1)) { per.eb(b); } if(mask & (1 << 2)) { per.eb(c); } sort(all(per)); do { string akt = per[0]; for(int i = 1; i < sz(per); i++) { akt = comb(akt, per[i]); } kt.insert(akt); }while(next_permutation(all(per))); } int t; cin >> t; string s; cin >> s; while(t >= 0) { bool czy = 0; for(auto x : kt) { if(x == s) { czy = 1; } } if(czy) { cout << "Yes\n"; } else { cout << "No\n"; } if(t > 0) { int l, r; char zn; cin >> l >> r >> zn; for(int i = l - 1; i < r; i++) { s[i] = zn; } } t--; } } int main() { fastio(); int t = 1; //cin >> t; while(t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...