Submission #670436

# Submission time Handle Problem Language Result Execution time Memory
670436 2022-12-09T05:57:54 Z PoPularPlusPlus Crossing (JOI21_crossing) C++17
26 / 100
97 ms 5036 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long 
#define pb(e) push_back(e)
#define sv(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+n)
#define mp(a,b) make_pair(a,b)
#define vf first
#define vs second
#define ar array
#define all(x) x.begin(),x.end()
const int inf = 0x3f3f3f3f;
const int mod = 1000000007; 
const double PI=3.14159265358979323846264338327950288419716939937510582097494459230;
bool remender(ll a , ll b){return a%b;}

//freopen("problemname.in", "r", stdin);
//freopen("problemname.out", "w", stdout);

string merge(string s , string t){
	for(int i = 0; i < (int)s.size(); i++){
		if(s[i] != t[i]){
			if(s[i]!='J' && t[i] != 'J')s[i] = 'J';
			else if(s[i]!='O' && t[i] != 'O')s[i] = 'O';
			else s[i] = 'I';
		}
	}
	return s;
}

void solve(){
	int n;
	cin >> n;
	string a,b,c;
	cin >> a >> b >> c;
	map<string,int> m;
	m[a] = 1;
	m[b] = 1;
	m[c] = 1;
	vector<string> v;
	v.pb(a);
	v.pb(b);
	v.pb(c);
	for(int i = 0; i < (int)v.size(); i++){
		for(int j = 0; j < (int)v.size(); j++){
			string s = merge(v[i],v[j]);
			if(m[s] == 1)continue;
			v.pb(s);
			m[s] = 1;
		}
	}
	assert(v.size() < 50);
	int q;
	cin >> q;
	string s;
	cin >> s;
	string ans = "No";
	for(int i = 0; i < (int)v.size(); i++){
		if(s == v[i]){
			ans = "Yes";
			break;
		}
	}
	cout << ans << '\n';
	while(q--){
		int l , r;
		cin >> l >> r;
		char tp;
		cin >> tp;
		for(int i = l - 1; i <= r - 1; i++){
			s[i] = tp;
		}
		ans = "No";
		for(int i = 0; i < n; i++){
			if(s == v[i]){
				ans = "Yes";
				break;
			}
		}
		cout << ans << '\n';
	}
}

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
	//int t;cin >> t;while(t--)
	solve();
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 52 ms 844 KB Output is correct
2 Correct 60 ms 844 KB Output is correct
3 Correct 90 ms 848 KB Output is correct
4 Correct 56 ms 864 KB Output is correct
5 Correct 57 ms 2248 KB Output is correct
6 Correct 54 ms 2304 KB Output is correct
7 Correct 62 ms 2488 KB Output is correct
8 Correct 58 ms 2348 KB Output is correct
9 Correct 57 ms 2376 KB Output is correct
10 Correct 59 ms 2320 KB Output is correct
11 Correct 58 ms 2364 KB Output is correct
12 Correct 58 ms 2508 KB Output is correct
13 Correct 57 ms 2424 KB Output is correct
14 Correct 59 ms 2368 KB Output is correct
15 Correct 56 ms 2324 KB Output is correct
16 Correct 59 ms 2336 KB Output is correct
17 Correct 60 ms 2384 KB Output is correct
18 Correct 93 ms 2252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 844 KB Output is correct
2 Correct 60 ms 844 KB Output is correct
3 Correct 90 ms 848 KB Output is correct
4 Correct 56 ms 864 KB Output is correct
5 Correct 57 ms 2248 KB Output is correct
6 Correct 54 ms 2304 KB Output is correct
7 Correct 62 ms 2488 KB Output is correct
8 Correct 58 ms 2348 KB Output is correct
9 Correct 57 ms 2376 KB Output is correct
10 Correct 59 ms 2320 KB Output is correct
11 Correct 58 ms 2364 KB Output is correct
12 Correct 58 ms 2508 KB Output is correct
13 Correct 57 ms 2424 KB Output is correct
14 Correct 59 ms 2368 KB Output is correct
15 Correct 56 ms 2324 KB Output is correct
16 Correct 59 ms 2336 KB Output is correct
17 Correct 60 ms 2384 KB Output is correct
18 Correct 93 ms 2252 KB Output is correct
19 Runtime error 6 ms 5036 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 52 ms 844 KB Output is correct
2 Correct 60 ms 844 KB Output is correct
3 Correct 90 ms 848 KB Output is correct
4 Correct 56 ms 864 KB Output is correct
5 Correct 57 ms 2248 KB Output is correct
6 Correct 54 ms 2304 KB Output is correct
7 Correct 62 ms 2488 KB Output is correct
8 Correct 58 ms 2348 KB Output is correct
9 Correct 57 ms 2376 KB Output is correct
10 Correct 59 ms 2320 KB Output is correct
11 Correct 58 ms 2364 KB Output is correct
12 Correct 58 ms 2508 KB Output is correct
13 Correct 57 ms 2424 KB Output is correct
14 Correct 59 ms 2368 KB Output is correct
15 Correct 56 ms 2324 KB Output is correct
16 Correct 59 ms 2336 KB Output is correct
17 Correct 60 ms 2384 KB Output is correct
18 Correct 93 ms 2252 KB Output is correct
19 Correct 64 ms 2264 KB Output is correct
20 Correct 97 ms 2204 KB Output is correct
21 Correct 60 ms 2396 KB Output is correct
22 Correct 50 ms 2204 KB Output is correct
23 Correct 59 ms 2364 KB Output is correct
24 Correct 55 ms 2240 KB Output is correct
25 Correct 61 ms 2380 KB Output is correct
26 Correct 52 ms 2308 KB Output is correct
27 Correct 63 ms 2384 KB Output is correct
28 Correct 53 ms 2224 KB Output is correct
29 Correct 58 ms 2384 KB Output is correct
30 Correct 51 ms 2236 KB Output is correct
31 Correct 66 ms 2356 KB Output is correct
32 Correct 67 ms 2412 KB Output is correct
33 Correct 64 ms 2412 KB Output is correct
34 Correct 56 ms 2252 KB Output is correct
35 Correct 63 ms 2368 KB Output is correct
36 Correct 62 ms 2404 KB Output is correct
37 Correct 65 ms 2380 KB Output is correct
38 Correct 64 ms 2336 KB Output is correct
39 Correct 66 ms 2348 KB Output is correct
40 Correct 64 ms 2360 KB Output is correct
41 Correct 65 ms 2420 KB Output is correct
42 Correct 64 ms 2380 KB Output is correct
43 Correct 59 ms 2380 KB Output is correct
44 Correct 62 ms 2328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 844 KB Output is correct
2 Correct 60 ms 844 KB Output is correct
3 Correct 90 ms 848 KB Output is correct
4 Correct 56 ms 864 KB Output is correct
5 Correct 57 ms 2248 KB Output is correct
6 Correct 54 ms 2304 KB Output is correct
7 Correct 62 ms 2488 KB Output is correct
8 Correct 58 ms 2348 KB Output is correct
9 Correct 57 ms 2376 KB Output is correct
10 Correct 59 ms 2320 KB Output is correct
11 Correct 58 ms 2364 KB Output is correct
12 Correct 58 ms 2508 KB Output is correct
13 Correct 57 ms 2424 KB Output is correct
14 Correct 59 ms 2368 KB Output is correct
15 Correct 56 ms 2324 KB Output is correct
16 Correct 59 ms 2336 KB Output is correct
17 Correct 60 ms 2384 KB Output is correct
18 Correct 93 ms 2252 KB Output is correct
19 Runtime error 6 ms 5036 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -