답안 #881330

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
881330 2023-12-01T06:52:28 Z arashMLG Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 5864 KB
#include<bits/stdc++.h>
#ifdef LOCAL
#include "Essentials/algo/debug.h"
#else
#define debug(...) 69
#endif
using namespace std;

typedef long long     ll;
typedef pair<int,int> pii;

const int N = 2e5 + 23;
const ll inf = 1e18;

#define F           first
#define S           second
#define pb          push_back
#define kill(x)     cout<<x<<endl, exit(0);
#define all(x)      x.begin(),x.end()
#define sz(x)       (int)x.size()
#define lc          (v << 1)
#define rc          ((v<<1) |1)

int n,q;
string a,b,c,beg;
vector<string> strs;

string cross(string one,string two) {
	string ans; ans.resize(n+1);
	for(int i = 0; i <= n ; i++) {
		if(one[i] == two[i]) ans[i] = one[i];
		else{
			if('J' != one[i] && 'J' != two[i]) ans[i] = 'J';
			else if('O' != one[i] && 'O' != two[i]) ans[i] = 'O';
			else ans[i] = 'I';
		}
	}
	return ans;
}

int32_t main() {
    cin.tie(nullptr)->sync_with_stdio(false);
	cin>>n>>a>>b>>c; a= "#" + a; b = "#" + b; c = "#" + c;
	strs.pb(a);
	strs.pb(b);
	strs.pb(c);
	strs.pb(cross(a,b));
	strs.pb(cross(a,c));
	strs.pb(cross(b,c));
	strs.pb(cross(cross(a,b),c));
	strs.pb(cross(cross(a,c),b));
	strs.pb(cross(cross(b,a),c));
	strs.pb(cross(cross(b,c),a));
	strs.pb(cross(cross(c,a),b));
	strs.pb(cross(cross(c,b),a));
	cin>>q>>beg; beg = "#" + beg;
	bool ans = false;
	for(string hello : strs) ans |= (beg == hello);
	cout<<(ans ? "Yes" : "No") << '\n';
	while(q--) {
		int l,r; char c; cin>>l>>r>>c;
		for(int i = l ; i <= r; i ++) beg[i] = c;
		ans = false;
		for(string hello : strs) ans |= (beg == hello);
		cout<<(ans ? "Yes" : "No") << '\n';
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 2028 KB Output is correct
2 Correct 93 ms 2268 KB Output is correct
3 Correct 107 ms 2160 KB Output is correct
4 Correct 103 ms 2236 KB Output is correct
5 Correct 96 ms 2132 KB Output is correct
6 Correct 93 ms 2068 KB Output is correct
7 Correct 98 ms 2132 KB Output is correct
8 Correct 100 ms 2288 KB Output is correct
9 Correct 98 ms 2128 KB Output is correct
10 Correct 96 ms 2236 KB Output is correct
11 Correct 96 ms 2092 KB Output is correct
12 Correct 101 ms 2384 KB Output is correct
13 Correct 98 ms 2132 KB Output is correct
14 Correct 96 ms 2192 KB Output is correct
15 Correct 96 ms 2132 KB Output is correct
16 Correct 100 ms 2136 KB Output is correct
17 Correct 89 ms 2128 KB Output is correct
18 Correct 110 ms 2132 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 2028 KB Output is correct
2 Correct 93 ms 2268 KB Output is correct
3 Correct 107 ms 2160 KB Output is correct
4 Correct 103 ms 2236 KB Output is correct
5 Correct 96 ms 2132 KB Output is correct
6 Correct 93 ms 2068 KB Output is correct
7 Correct 98 ms 2132 KB Output is correct
8 Correct 100 ms 2288 KB Output is correct
9 Correct 98 ms 2128 KB Output is correct
10 Correct 96 ms 2236 KB Output is correct
11 Correct 96 ms 2092 KB Output is correct
12 Correct 101 ms 2384 KB Output is correct
13 Correct 98 ms 2132 KB Output is correct
14 Correct 96 ms 2192 KB Output is correct
15 Correct 96 ms 2132 KB Output is correct
16 Correct 100 ms 2136 KB Output is correct
17 Correct 89 ms 2128 KB Output is correct
18 Correct 110 ms 2132 KB Output is correct
19 Execution timed out 7089 ms 5864 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 2028 KB Output is correct
2 Correct 93 ms 2268 KB Output is correct
3 Correct 107 ms 2160 KB Output is correct
4 Correct 103 ms 2236 KB Output is correct
5 Correct 96 ms 2132 KB Output is correct
6 Correct 93 ms 2068 KB Output is correct
7 Correct 98 ms 2132 KB Output is correct
8 Correct 100 ms 2288 KB Output is correct
9 Correct 98 ms 2128 KB Output is correct
10 Correct 96 ms 2236 KB Output is correct
11 Correct 96 ms 2092 KB Output is correct
12 Correct 101 ms 2384 KB Output is correct
13 Correct 98 ms 2132 KB Output is correct
14 Correct 96 ms 2192 KB Output is correct
15 Correct 96 ms 2132 KB Output is correct
16 Correct 100 ms 2136 KB Output is correct
17 Correct 89 ms 2128 KB Output is correct
18 Correct 110 ms 2132 KB Output is correct
19 Correct 92 ms 1968 KB Output is correct
20 Correct 107 ms 2128 KB Output is correct
21 Correct 97 ms 2128 KB Output is correct
22 Correct 88 ms 2160 KB Output is correct
23 Correct 96 ms 1876 KB Output is correct
24 Correct 93 ms 2036 KB Output is correct
25 Correct 98 ms 1988 KB Output is correct
26 Correct 93 ms 1872 KB Output is correct
27 Correct 97 ms 1876 KB Output is correct
28 Correct 88 ms 1872 KB Output is correct
29 Correct 97 ms 1880 KB Output is correct
30 Correct 91 ms 2384 KB Output is correct
31 Correct 104 ms 1888 KB Output is correct
32 Correct 99 ms 1932 KB Output is correct
33 Correct 96 ms 1836 KB Output is correct
34 Correct 96 ms 2132 KB Output is correct
35 Correct 97 ms 1872 KB Output is correct
36 Correct 107 ms 1864 KB Output is correct
37 Correct 97 ms 1820 KB Output is correct
38 Correct 96 ms 1928 KB Output is correct
39 Correct 96 ms 1876 KB Output is correct
40 Correct 96 ms 1876 KB Output is correct
41 Correct 96 ms 1876 KB Output is correct
42 Correct 97 ms 1872 KB Output is correct
43 Correct 96 ms 1884 KB Output is correct
44 Correct 99 ms 1872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 2028 KB Output is correct
2 Correct 93 ms 2268 KB Output is correct
3 Correct 107 ms 2160 KB Output is correct
4 Correct 103 ms 2236 KB Output is correct
5 Correct 96 ms 2132 KB Output is correct
6 Correct 93 ms 2068 KB Output is correct
7 Correct 98 ms 2132 KB Output is correct
8 Correct 100 ms 2288 KB Output is correct
9 Correct 98 ms 2128 KB Output is correct
10 Correct 96 ms 2236 KB Output is correct
11 Correct 96 ms 2092 KB Output is correct
12 Correct 101 ms 2384 KB Output is correct
13 Correct 98 ms 2132 KB Output is correct
14 Correct 96 ms 2192 KB Output is correct
15 Correct 96 ms 2132 KB Output is correct
16 Correct 100 ms 2136 KB Output is correct
17 Correct 89 ms 2128 KB Output is correct
18 Correct 110 ms 2132 KB Output is correct
19 Execution timed out 7089 ms 5864 KB Time limit exceeded
20 Halted 0 ms 0 KB -