100862024-03-26 17:48:34111Génsebészcpp17Wrong answer 30/100273ms30240 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]=S[i];
		z[S[i]].insert(i);
	}
	s[n]=0;
}

void Beszur(int i,char x){
	auto it=s.find_by_order(i);
	double y=(it->first+next(it)->first)/2;
	if(s.find(y)!=s.end())exit(1);
	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
1Accepted3ms1836 KiB
2Accepted3ms2248 KiB
subtask230/30
3Accepted3ms2384 KiB
4Accepted3ms2468 KiB
5Accepted4ms2788 KiB
6Accepted4ms2808 KiB
7Accepted6ms3188 KiB
8Accepted74ms10716 KiB
subtask30/30
9Wrong answer3ms3276 KiB
10Wrong answer3ms3268 KiB
11Wrong answer3ms3472 KiB
12Wrong answer3ms3700 KiB
13Wrong answer3ms4044 KiB
14Accepted101ms14216 KiB
subtask40/20
15Wrong answer3ms3876 KiB
16Wrong answer3ms3896 KiB
17Wrong answer3ms3916 KiB
18Wrong answer3ms4180 KiB
19Accepted127ms16904 KiB
subtask50/20
20Wrong answer4ms4988 KiB
21Wrong answer6ms5292 KiB
22Wrong answer7ms5760 KiB
23Wrong answer12ms7032 KiB
24Time limit exceeded273ms30240 KiB