Submission #855502

# Submission time Handle Problem Language Result Execution time Memory
855502 2023-10-01T11:17:03 Z jmyszka2007 Crossing (JOI21_crossing) C++17
3 / 100
7000 ms 6832 KB
#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);
		}
		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 time Memory Grader output
1 Correct 279 ms 2140 KB Output is correct
2 Correct 303 ms 2608 KB Output is correct
3 Correct 313 ms 2408 KB Output is correct
4 Correct 298 ms 2644 KB Output is correct
5 Correct 303 ms 2424 KB Output is correct
6 Correct 314 ms 2416 KB Output is correct
7 Correct 294 ms 2388 KB Output is correct
8 Correct 303 ms 2436 KB Output is correct
9 Correct 303 ms 2748 KB Output is correct
10 Correct 298 ms 2492 KB Output is correct
11 Correct 302 ms 2384 KB Output is correct
12 Correct 308 ms 2388 KB Output is correct
13 Correct 309 ms 2400 KB Output is correct
14 Correct 303 ms 2384 KB Output is correct
15 Correct 316 ms 2496 KB Output is correct
16 Correct 302 ms 2316 KB Output is correct
17 Correct 310 ms 2460 KB Output is correct
18 Correct 339 ms 2588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 279 ms 2140 KB Output is correct
2 Correct 303 ms 2608 KB Output is correct
3 Correct 313 ms 2408 KB Output is correct
4 Correct 298 ms 2644 KB Output is correct
5 Correct 303 ms 2424 KB Output is correct
6 Correct 314 ms 2416 KB Output is correct
7 Correct 294 ms 2388 KB Output is correct
8 Correct 303 ms 2436 KB Output is correct
9 Correct 303 ms 2748 KB Output is correct
10 Correct 298 ms 2492 KB Output is correct
11 Correct 302 ms 2384 KB Output is correct
12 Correct 308 ms 2388 KB Output is correct
13 Correct 309 ms 2400 KB Output is correct
14 Correct 303 ms 2384 KB Output is correct
15 Correct 316 ms 2496 KB Output is correct
16 Correct 302 ms 2316 KB Output is correct
17 Correct 310 ms 2460 KB Output is correct
18 Correct 339 ms 2588 KB Output is correct
19 Correct 4604 ms 6832 KB Output is correct
20 Execution timed out 7049 ms 4784 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 279 ms 2140 KB Output is correct
2 Correct 303 ms 2608 KB Output is correct
3 Correct 313 ms 2408 KB Output is correct
4 Correct 298 ms 2644 KB Output is correct
5 Correct 303 ms 2424 KB Output is correct
6 Correct 314 ms 2416 KB Output is correct
7 Correct 294 ms 2388 KB Output is correct
8 Correct 303 ms 2436 KB Output is correct
9 Correct 303 ms 2748 KB Output is correct
10 Correct 298 ms 2492 KB Output is correct
11 Correct 302 ms 2384 KB Output is correct
12 Correct 308 ms 2388 KB Output is correct
13 Correct 309 ms 2400 KB Output is correct
14 Correct 303 ms 2384 KB Output is correct
15 Correct 316 ms 2496 KB Output is correct
16 Correct 302 ms 2316 KB Output is correct
17 Correct 310 ms 2460 KB Output is correct
18 Correct 339 ms 2588 KB Output is correct
19 Correct 337 ms 2300 KB Output is correct
20 Correct 363 ms 2340 KB Output is correct
21 Correct 326 ms 2896 KB Output is correct
22 Correct 286 ms 2308 KB Output is correct
23 Correct 313 ms 2372 KB Output is correct
24 Correct 308 ms 2388 KB Output is correct
25 Correct 322 ms 2400 KB Output is correct
26 Correct 306 ms 2324 KB Output is correct
27 Correct 316 ms 2480 KB Output is correct
28 Correct 292 ms 2556 KB Output is correct
29 Correct 318 ms 2496 KB Output is correct
30 Correct 298 ms 2292 KB Output is correct
31 Correct 354 ms 2388 KB Output is correct
32 Correct 358 ms 2776 KB Output is correct
33 Incorrect 348 ms 2384 KB Output isn't correct
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 279 ms 2140 KB Output is correct
2 Correct 303 ms 2608 KB Output is correct
3 Correct 313 ms 2408 KB Output is correct
4 Correct 298 ms 2644 KB Output is correct
5 Correct 303 ms 2424 KB Output is correct
6 Correct 314 ms 2416 KB Output is correct
7 Correct 294 ms 2388 KB Output is correct
8 Correct 303 ms 2436 KB Output is correct
9 Correct 303 ms 2748 KB Output is correct
10 Correct 298 ms 2492 KB Output is correct
11 Correct 302 ms 2384 KB Output is correct
12 Correct 308 ms 2388 KB Output is correct
13 Correct 309 ms 2400 KB Output is correct
14 Correct 303 ms 2384 KB Output is correct
15 Correct 316 ms 2496 KB Output is correct
16 Correct 302 ms 2316 KB Output is correct
17 Correct 310 ms 2460 KB Output is correct
18 Correct 339 ms 2588 KB Output is correct
19 Correct 4604 ms 6832 KB Output is correct
20 Execution timed out 7049 ms 4784 KB Time limit exceeded
21 Halted 0 ms 0 KB -