QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#175592#5680. You You See What?zhoujiuAC ✓4ms3864kbC++201.3kb2023-09-10 20:14:342023-09-10 20:14:35

Judging History

你现在查看的是最新测评结果

  • [2023-09-10 20:14:35]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3864kb
  • [2023-09-10 20:14:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

vector<string> s;

bool check(string a,string b)
{
	if(a.size()!=b.size()) return false;
	for(int i=0;i<a.size();i++)
	{
		if(a[i]<='Z'&&a[i]>='A') a[i]+=32;
		if(b[i]<='Z'&&b[i]>='A') b[i]+=32;
		
		if(a[i]!=b[i])
			return false;
	}
	return true;
}

bool check1(int l,int r)
{
	vector<string> q;
	for(int i=l;i<=r;i++) q.push_back(s[i]);

	for(int i=0;i<q.size()/2;i++)
		if(!check(q[i],q[q.size()-1-i]))
			return false;

	return true;
}

signed main()
{
	string a;
	cin>>a;

	for(int i=0;i<a.size();i++)
	{
		int j;
		string c="";
		for(j=i;j<a.size();j++)
		{
			if(a[j]=='!') break;
			c+=a[j];
		}
		i=j;
		s.push_back(c);
	}

	string c=s.back();
	s.erase(s.end());

	int cnt=0;	
	while(cnt!=s.size())
	{
		cnt=s.size();
		vector<string> ans;
		for(int i=0;i<s.size();i++)
		{
			bool flag=0;
			for(int j=s.size()-1;j>i;j--)
			{
				if(check1(i,j))
				{
					// cout<<i<<' '<<j<<endl;
					flag=1;
					ans.push_back(s[i]);
					i=j;
					break;
				}
			}

			if(!flag)
				ans.push_back(s[i]);
		}

		s=ans;
		// cnt=s.size();
		// for(int i=0;i<s.size();i++)
		// 	cout<<s[i]<<' ';
		// cout<<endl;
	}

	for(int i=0;i<s.size();i++)
	{
		cout<<s[i]<<"!";
	}
	cout<<c<<endl;

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3552kb

input:

texasam!rice!baylor!csdept!baylor!rice!dev!bresearch!bpoucher

output:

texasam!rice!dev!bresearch!bpoucher

result:

ok single line: 'texasam!rice!dev!bresearch!bpoucher'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

texasam!Rice!baYlor!csdept!BayloR!dev!Rice!bresearch!bpoucher

output:

texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher

result:

ok single line: 'texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

bresearch!bpoucher

output:

bresearch!bpoucher

result:

ok single line: 'bresearch!bpoucher'

Test #4:

score: 0
Accepted
time: 4ms
memory: 3572kb

input:

a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x

output:

a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x

result:

ok single line: 'a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!...i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x'

Test #5:

score: 0
Accepted
time: 2ms
memory: 3572kb

input:

a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!xx

output:

a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!xx

result:

ok single line: 'a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!...!j!k!l!m!n!o!p!q!r!s!t!u!v!w!xx'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z

output:

a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z!a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z

result:

ok single line: 'a!b!c!d!e!f!g!h!i!j!k!l!m!n!o!...k!l!m!n!o!p!q!r!s!t!u!v!w!x!y!z'

Test #7:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

abcdEFGHij!bbcdEFGHij!cbcdEFGHij!dbcdEFGHij!ebcdEFGHij!fbcdEFGHij!gbcdEFGHij!hbcdEFGHij!ibcdEFGHij!jbcdEFGHij!kbcdEFGHij!lbcdEFGHij!mbcdEFGHij!nbcdEFGHij!obcdEFGHij!pbcdEFGHij!qbcdEFGHij!rbcdEFGHij!sbcdEFGHij!tbcdEFGHij!ubcdEFGHij!vbcdEFGHij!wbcdEFGHij!abc

output:

abcdEFGHij!bbcdEFGHij!cbcdEFGHij!dbcdEFGHij!ebcdEFGHij!fbcdEFGHij!gbcdEFGHij!hbcdEFGHij!ibcdEFGHij!jbcdEFGHij!kbcdEFGHij!lbcdEFGHij!mbcdEFGHij!nbcdEFGHij!obcdEFGHij!pbcdEFGHij!qbcdEFGHij!rbcdEFGHij!sbcdEFGHij!tbcdEFGHij!ubcdEFGHij!vbcdEFGHij!wbcdEFGHij!abc

result:

ok single line: 'abcdEFGHij!bbcdEFGHij!cbcdEFGH...FGHij!vbcdEFGHij!wbcdEFGHij!abc'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abcdEFGHij!abc

output:

abcdEFGHij!abc

result:

ok single line: 'abcdEFGHij!abc'

Test #9:

score: 0
Accepted
time: 4ms
memory: 3512kb

input:

a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!bb

output:

a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!a!bb

result:

ok single line: 'a!b!c!a!b!c!a!b!c!a!b!c!a!b!c!...!c!a!b!c!a!b!c!a!b!c!a!b!c!a!bb'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!Bb!Aa!BB!aA!bB!aa!bB!aA!BB!Aa!B

output:

aa!B

result:

ok single line: 'aa!B'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

b

output:

b

result:

ok single line: 'b'

Test #12:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

bpoucher

output:

bpoucher

result:

ok single line: 'bpoucher'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

Abcdefghij

output:

Abcdefghij

result:

ok single line: 'Abcdefghij'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

polyof!johnb

output:

polyof!johnb

result:

ok single line: 'polyof!johnb'

Test #15:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

polyvm!polyof!gracie!johnb

output:

polyvm!polyof!gracie!johnb

result:

ok single line: 'polyvm!polyof!gracie!johnb'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

a!b!b!c!c!d!d!d!e!e!e

output:

a!b!c!d!e!e

result:

ok single line: 'a!b!c!d!e!e'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3556kb

input:

aaaa!bbbbb!bbbbb!testacct

output:

aaaa!bbbbb!testacct

result:

ok single line: 'aaaa!bbbbb!testacct'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

a!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b

output:

a!b!b

result:

ok single line: 'a!b!b'

Test #19:

score: 0
Accepted
time: 1ms
memory: 3864kb

input:

a!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!bb!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b

output:

a!b!b

result:

ok single line: 'a!b!b'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

a!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!c!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b

output:

a!b!b

result:

ok single line: 'a!b!b'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

a!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!c!d!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b!b

output:

a!b!c!d!b!b

result:

ok single line: 'a!b!c!d!b!b'