QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#678750#7262. String ModificationImran_86WA 0ms3728kbC++20993b2024-10-26 16:01:422024-10-26 16:01:42

Judging History

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

  • [2024-10-26 16:01:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3728kb
  • [2024-10-26 16:01:42]
  • 提交

answer

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


#define ff first
#define ss second
#define pb push_back
#define ll long long int
#define all(v) (v).begin(),(v).end()
#define set_bits __builtin_popcountll  


void solve()
{
   string s,s1;
   cin>>s>>s1;
   if(s[0]!=s1[0])
   {
    cout<<"No"<<endl;
   }
   else
   {
    int j=0;
    int c=0;

    for (int i = 0; i < s.size(); ++i)
    {
        if(s[i]==s1[j])
        {
            j++;
            c=0;
        }
        else
        {
            if(s1[j]==s[i-1]&&c==0)
            {
                cout<<"No"<<endl;
                return;
            }
            else
            {
                c=1;
                i--;
                j++;
            }
        }
    }
    cout<<"Yes"<<endl;
   }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    /*int t;
    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: 3620kb

input:

snuke
snukent

output:

Yes

result:

ok answer is YES

Test #2:

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

input:

snuke
ssnuke

output:

No

result:

ok answer is NO

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3728kb

input:

babaaaabaabbabbbbaaabaabbbbbbaaaababababbbbaabbaaaababababaaabaababbaaabbbbaabbbbbbbabaaabbaaaaabbbbabbabaabbbaaabaababbbabbaababbaaaababbaabbbaabbbababbbb
baabbaababaaabababababbabbaabbbabbbbaaaabbabaababbababbaabbbaababaabbbabbbaabaabbababaababbaaabbaaababbaaaabbababababbbaaabbababababbbaaabbbabab...

output:

No

result:

wrong answer expected YES, found NO