/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 540.0 KiB
#2 Wrong Answer 6ms 588.0 KiB
#3 Wrong Answer 6ms 516.0 KiB

Code

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

#define endl "\n"
#define trace(x) cout << #x << ": " << x << endl
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while(t--)
    {
        int n; cin >> n;
        string s, t; cin >> s >> t;
        int cnt1 = 0, cnt2 = 0;
        for(int i = n-1; i >= 0; i--)
        {
            //cout << s[i] << ' ' << s[i - 1] << endl;
            if(s[i] < s[i - 1]) cnt1++;
            if(t[i] < t[i - 1]) cnt2++;
            cnt1 += cnt1;
            cnt2 += cnt2;
        }
        if(cnt1 <= cnt2) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1117 String Sorted
Contest
LU IUJPC : Sylhet Division 2024, Mock Round
Language
C++17 (G++ 13.2.0)
Submit At
2024-12-07 10:17:05
Judged At
2024-12-07 10:17:05
Judged By
Score
1
Total Time
6ms
Peak Memory
588.0 KiB