Submission #876161

#TimeUsernameProblemLanguageResultExecution timeMemory
876161green_gold_dogCrossing (JOI21_crossing)C++17
26 / 100
7057 ms6060 KiB
//#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,sse,sse2,sse3,ssse3,sse4,abm,popcnt,mmx") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double db; typedef long double ldb; typedef complex<double> cd; constexpr ll INF64 = 9'000'000'000'000'000'000, INF32 = 2'000'000'000, MOD = 1'000'000'007; constexpr db PI = acos(-1); constexpr bool IS_FILE = false, IS_TEST_CASES = false; random_device rd; mt19937 rnd32(rd()); mt19937_64 rnd64(rd()); template<typename T> bool assign_max(T& a, T b) { if (b > a) { a = b; return true; } return false; } template<typename T> bool assign_min(T& a, T b) { if (b < a) { a = b; return true; } return false; } template<typename T> T square(T a) { return a * a; } template<> struct std::hash<pair<ll, ll>> { ll operator() (pair<ll, ll> p) const { return ((__int128)p.first * MOD + p.second) % INF64; } }; map<pair<char, char>, char> m; set<string> can; string make(string& s1, string& s2) { string ans(s1.size(), '.'); for (ll i = 0; i < s1.size(); i++) { ans[i] = m[make_pair(s1[i], s2[i])]; } return ans; } void rec(string& s, string& s1, string& s2, string& s3) { can.insert(s); s = make(s, s1); if (can.find(s) == can.end()) { rec(s, s1, s2, s3); } s = make(s, s1); s = make(s, s2); if (can.find(s) == can.end()) { rec(s, s1, s2, s3); } s = make(s, s2); s = make(s, s3); if (can.find(s) == can.end()) { rec(s, s1, s2, s3); } s = make(s, s3); } void solve() { m[make_pair('O', 'O')] = 'O'; m[make_pair('O', 'I')] = 'J'; m[make_pair('O', 'J')] = 'I'; m[make_pair('I', 'O')] = 'J'; m[make_pair('I', 'I')] = 'I'; m[make_pair('I', 'J')] = 'O'; m[make_pair('J', 'O')] = 'I'; m[make_pair('J', 'I')] = 'O'; m[make_pair('J', 'J')] = 'J'; ll n; cin >> n; string s1, s2, s3; cin >> s1 >> s2 >> s3; string s = s1; rec(s, s1, s2, s3); ll q; cin >> q; cin >> s; cout << (can.find(s) == can.end() ? "No" : "Yes") << '\n'; for (ll i = 0; i < q; i++) { ll l, r; char c; cin >> l >> r >> c; l--; for (ll j = l; j < r; j++) { s[j] = c; } cout << (can.find(s) == can.end() ? "No" : "Yes") << '\n'; } } int main() { if (IS_FILE) { freopen("", "r", stdin); freopen("", "w", stdout); } ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll t = 1; if (IS_TEST_CASES) { cin >> t; } for (ll i = 0; i < t; i++) { solve(); } }

Compilation message (stderr)

Main.cpp: In function 'std::string make(std::string&, std::string&)':
Main.cpp:56:26: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         for (ll i = 0; i < s1.size(); i++) {
      |                        ~~^~~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:115:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  115 |                 freopen("", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~
Main.cpp:116:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  116 |                 freopen("", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...