100882024-03-26 17:51:50111Génsebészcpp17Wrong answer 30/100101ms30128 KiB
#ifdef ONLINE_JUDGE
#include "grader.h"
#endif

#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;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename T, typename V>
using ordered_map = tree<T, V, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ordered_map<double,char>s;
ordered_set<double>z[200];

void Kezd(string S){
	int n=S.size();
	s[-1]=0;
	for(int i=0;i<n;i++){
		s[i*n]=S[i];
		z[S[i]].insert(i*n);
	}
	s[n*n]=0;
}

void Beszur(int i,char x){
	auto it=s.find_by_order(i);
	double y=(it->first+next(it)->first)/2;
	s[y]=x;
	z[x].insert(y);
}

void Mutal(int i,char x){
	auto it=s.find_by_order(i);
	int y=it->first;
	z[it->second].erase(y);
	s[y]=x;
	z[x].insert(y);
}

void Kivag(int i,int j){
	auto it1=s.find_by_order(i);
	auto it2=s.find_by_order(j+1);
	while(it1!=it2){
		z[it1->second].erase(it1->first);
		it1=s.erase(it1);
	}
}

int Szamlal(int i,int j,char x){
	auto it1=s.find_by_order(i);
	auto it2=s.find_by_order(j+1);
	return z[x].order_of_key(it2->first)-z[x].order_of_key(it1->first);
}

string Eredmeny(){
	string ans;
	for(auto [_,x]:s){
		if(x==0)continue;
		ans+=x;
	}
	return ans;
}

#ifndef ONLINE_JUDGE
int main(){
	freopen("be2.txt","r",stdin);
	string S;
	cin>>S;
	Kezd(S);
	while(true){
		int o;
		cin>>o;
		if(o==0){
			break;
		}
		if(o==1){
			int i;
			char x;
			cin>>i>>x;
			Beszur(i,x);
		}
		if(o==2){
			int i;
			char x;
			cin>>i>>x;
			Mutal(i,x);
		}
		if(o==3){
			int i,j;
			cin>>i>>j;
			Kivag(i,j);
		}
		if(o==4){
			int i,j;
			char x;
			cin>>i>>j>>x;
			int res=Szamlal(i,j,x);
			int ans;
			cin>>ans;
			ans--;
			if(res!=ans){
				cout<<"got "<<res<<'\n';
				cout<<"exp "<<ans<<'\n';
				return 1;
			}
		}
		if(o==5){
			string res=Eredmeny();
			string ans;
			cin>>ans;
			ans.pop_back();
			if(res!=ans){
				cout<<"got "<<res<<'\n';
				cout<<"exp "<<ans<<'\n';
				return 1;
			}
		}
	}
	return 0;
}
#endif
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1960 KiB
2Accepted3ms2436 KiB
subtask230/30
3Accepted3ms2548 KiB
4Accepted3ms2740 KiB
5Accepted4ms3212 KiB
6Accepted4ms3180 KiB
7Accepted6ms3452 KiB
8Accepted75ms10996 KiB
subtask30/30
9Accepted3ms3692 KiB
10Wrong answer3ms3800 KiB
11Accepted4ms4004 KiB
12Wrong answer4ms3980 KiB
13Accepted6ms4192 KiB
14Accepted101ms14164 KiB
subtask40/20
15Wrong answer3ms3968 KiB
16Wrong answer3ms3928 KiB
17Wrong answer3ms4260 KiB
18Wrong answer3ms4424 KiB
19Wrong answer52ms17192 KiB
subtask50/20
20Wrong answer4ms5440 KiB
21Wrong answer6ms5772 KiB
22Wrong answer7ms6028 KiB
23Wrong answer12ms7308 KiB
24Wrong answer93ms30128 KiB