Submission #419575

# Submission time Handle Problem Language Result Execution time Memory
419575 2021-06-07T09:41:48 Z zaneyu Crossing (JOI21_crossing) C++14
26 / 100
7000 ms 4356 KB
/*input
3
JOI
JOI
JOI
2
OJI
1 2 O
1 1 J
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("Ofast")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld double
#define pii pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (ll)x.size()
const ll maxn=1e6+5;
const ll maxlg=__lg(maxn)+2;
const ll INF64=4e17;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-4;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll mult(ll a,ll b){
	return (a*b)%MOD;
}
ll mypow(ll a,ll b){
	ll res=1;
	while(b){
		if(b&1) res=mult(res,a);
		a=mult(a,a);
		b/=2;
	}
	return res;
}
string arr[3];
string bl="JOI";
string op(string a,string b){
	string ans="";
	REP(i,sz(a)){
		if(a[i]==b[i]) ans.pb(a[i]);
		else{
			REP(k,3){
				if(bl[k]!=a[i] and bl[k]!=b[i]) ans.pb(bl[k]);
			}
		}
	}
	return ans;
}
int main(){
	ios::sync_with_stdio(false),cin.tie(0);
	int n;
	cin>>n;
	REP(i,3) cin>>arr[i];
	vector<string> v;
	REP(i,3){
		v.pb(arr[i]);
		REP(j,i){
			v.pb(op(arr[i],arr[j]));
		}
	}
	vector<int> b;
	REP(i,3) b.pb(i);
	do{
		string cur="";
		for(auto x:b){
			if(!sz(cur)) cur=arr[x];
			else cur=op(cur,arr[x]);
		}
		v.pb(cur);
	}while(next_permutation(ALL(b)));
	int q;
	cin>>q;
	string s;
	cin>>s;
	bool hv=0;
	for(auto x:v){
		if(x==s){
			cout<<"Yes\n";
			hv=1;
			break;
		}
	}
	if(!hv) cout<<"No\n";
	while(q--){
		int l,r;
		char c;
		cin>>l>>r>>c;
		--l,--r;
		for(int i=l;i<=r;i++) s[i]=c;
		bool hv=0;
		for(auto x:v){
			if(x==s){
				cout<<"Yes\n";
				hv=1;
				break;
			}
		}
		if(!hv) cout<<"No\n";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 143 ms 836 KB Output is correct
2 Correct 148 ms 900 KB Output is correct
3 Correct 232 ms 808 KB Output is correct
4 Correct 144 ms 872 KB Output is correct
5 Correct 149 ms 792 KB Output is correct
6 Correct 135 ms 848 KB Output is correct
7 Correct 156 ms 836 KB Output is correct
8 Correct 153 ms 852 KB Output is correct
9 Correct 150 ms 836 KB Output is correct
10 Correct 150 ms 844 KB Output is correct
11 Correct 176 ms 836 KB Output is correct
12 Correct 146 ms 848 KB Output is correct
13 Correct 176 ms 812 KB Output is correct
14 Correct 160 ms 896 KB Output is correct
15 Correct 150 ms 804 KB Output is correct
16 Correct 148 ms 824 KB Output is correct
17 Correct 145 ms 836 KB Output is correct
18 Correct 183 ms 868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 836 KB Output is correct
2 Correct 148 ms 900 KB Output is correct
3 Correct 232 ms 808 KB Output is correct
4 Correct 144 ms 872 KB Output is correct
5 Correct 149 ms 792 KB Output is correct
6 Correct 135 ms 848 KB Output is correct
7 Correct 156 ms 836 KB Output is correct
8 Correct 153 ms 852 KB Output is correct
9 Correct 150 ms 836 KB Output is correct
10 Correct 150 ms 844 KB Output is correct
11 Correct 176 ms 836 KB Output is correct
12 Correct 146 ms 848 KB Output is correct
13 Correct 176 ms 812 KB Output is correct
14 Correct 160 ms 896 KB Output is correct
15 Correct 150 ms 804 KB Output is correct
16 Correct 148 ms 824 KB Output is correct
17 Correct 145 ms 836 KB Output is correct
18 Correct 183 ms 868 KB Output is correct
19 Execution timed out 7044 ms 4356 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 143 ms 836 KB Output is correct
2 Correct 148 ms 900 KB Output is correct
3 Correct 232 ms 808 KB Output is correct
4 Correct 144 ms 872 KB Output is correct
5 Correct 149 ms 792 KB Output is correct
6 Correct 135 ms 848 KB Output is correct
7 Correct 156 ms 836 KB Output is correct
8 Correct 153 ms 852 KB Output is correct
9 Correct 150 ms 836 KB Output is correct
10 Correct 150 ms 844 KB Output is correct
11 Correct 176 ms 836 KB Output is correct
12 Correct 146 ms 848 KB Output is correct
13 Correct 176 ms 812 KB Output is correct
14 Correct 160 ms 896 KB Output is correct
15 Correct 150 ms 804 KB Output is correct
16 Correct 148 ms 824 KB Output is correct
17 Correct 145 ms 836 KB Output is correct
18 Correct 183 ms 868 KB Output is correct
19 Correct 152 ms 904 KB Output is correct
20 Correct 188 ms 896 KB Output is correct
21 Correct 154 ms 868 KB Output is correct
22 Correct 156 ms 760 KB Output is correct
23 Correct 145 ms 876 KB Output is correct
24 Correct 149 ms 836 KB Output is correct
25 Correct 152 ms 932 KB Output is correct
26 Correct 154 ms 860 KB Output is correct
27 Correct 143 ms 836 KB Output is correct
28 Correct 141 ms 808 KB Output is correct
29 Correct 152 ms 824 KB Output is correct
30 Correct 177 ms 740 KB Output is correct
31 Correct 145 ms 840 KB Output is correct
32 Correct 155 ms 892 KB Output is correct
33 Correct 154 ms 892 KB Output is correct
34 Correct 144 ms 888 KB Output is correct
35 Correct 190 ms 836 KB Output is correct
36 Correct 144 ms 828 KB Output is correct
37 Correct 169 ms 796 KB Output is correct
38 Correct 163 ms 812 KB Output is correct
39 Correct 149 ms 828 KB Output is correct
40 Correct 146 ms 884 KB Output is correct
41 Correct 144 ms 836 KB Output is correct
42 Correct 145 ms 1008 KB Output is correct
43 Correct 154 ms 840 KB Output is correct
44 Correct 143 ms 912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 836 KB Output is correct
2 Correct 148 ms 900 KB Output is correct
3 Correct 232 ms 808 KB Output is correct
4 Correct 144 ms 872 KB Output is correct
5 Correct 149 ms 792 KB Output is correct
6 Correct 135 ms 848 KB Output is correct
7 Correct 156 ms 836 KB Output is correct
8 Correct 153 ms 852 KB Output is correct
9 Correct 150 ms 836 KB Output is correct
10 Correct 150 ms 844 KB Output is correct
11 Correct 176 ms 836 KB Output is correct
12 Correct 146 ms 848 KB Output is correct
13 Correct 176 ms 812 KB Output is correct
14 Correct 160 ms 896 KB Output is correct
15 Correct 150 ms 804 KB Output is correct
16 Correct 148 ms 824 KB Output is correct
17 Correct 145 ms 836 KB Output is correct
18 Correct 183 ms 868 KB Output is correct
19 Execution timed out 7044 ms 4356 KB Time limit exceeded
20 Halted 0 ms 0 KB -