QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#180423#5680. You You See What?CloudsWA 0ms3452kbC++141.9kb2023-09-15 20:10:282023-09-15 20:10:29

Judging History

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

  • [2023-09-15 20:10:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3452kb
  • [2023-09-15 20:10:28]
  • 提交

answer

#include<bits/stdc++.h>
#define endl '\n'
#define int long long
using namespace std;


map<string,int>mp;
int idx;

void solve()
{
    string s;
    cin>>s;
    while(1)
    {
        mp.clear();
        string hou,p;
        int flag=0;
        for(int i=0;i<s.size();i++)
        {
            if(flag==1)
            {
                hou+=s[i];
                continue;
            }
            if(s[i]=='!')
            {
                if(mp.count(p)==0)
                {
                    mp[p]=++idx;
                    p="";
                }
                else
                {
                    flag=1;
                }
            }
            else
            {
                if(s[i]>='a'&&s[i]<='z')
                    p+=s[i];
                else
                {
                    char t=s[i];
                    t+=32;
                    p+=t;
                }
            }
        }
        if(flag==0)
        {
            cout<<s<<endl;
            return ;
        }
        string qian;
        string pp,t;
        //cout<<s<<endl;
        for(int i=0;i<s.size();i++)
        {
            if(s[i]=='!')
            {
                qian+=t;
                qian+='!';
                if(pp==p)
                    break;
                pp="";
                t="";
                
            }
            else
            {
                //cout<<s[i]<<endl;
                t+=s[i];
                if(s[i]>='a'&&s[i]<='z')
                    pp+=s[i];
                else
                {
                    char tt=s[i];
                    tt+=32;
                    pp+=tt;
                }
            }
        }
        s=qian+hou;
    }
    return ;
}

signed main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3452kb

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: -100
Wrong Answer
time: 0ms
memory: 3416kb

input:

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

output:

texasam!Rice!bresearch!bpoucher

result:

wrong answer 1st lines differ - expected: 'texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher', found: 'texasam!Rice!bresearch!bpoucher'