提出 #75105482


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define pb push_back

template<class T> inline bool chmax(T& a, T b) { return a < b ? a = b, 1 : 0; }
template<class T> inline bool chmin(T& a, T b) { return a > b ? a = b, 1 : 0; }

const int MOD = 1e9 + 7;
string process(string& s){
    string ans="";
    for(char c:s){
        ans+=c;
        int n=ans.size();
        if(n>=4&&ans[n-4]=='('&&ans[n-3]=='x'&&ans[n-2]=='x'&&ans[n-1]==')'){
            ans.pop_back();
            ans.pop_back();
            ans.pop_back();
            ans.pop_back();
            ans.push_back('x');
            ans.push_back('x');
        }
        
    }
    return ans;
}
void solve() {
    string a,b;cin>>a>>b;
    a=process(a),b=process(b);
    cout<<(a==b?"Yes\n":"No\n");
    
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int tt = 1;
    cin>>tt;
    while (tt--) {
        solve();
    }

    return 0;
}

提出情報

提出日時
問題 D - (xx)
ユーザ lavi3
言語 C++23 (GCC 15.2.0)
得点 425
コード長 1140 Byte
結果 AC
実行時間 31 ms
メモリ 8128 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 425 / 425
結果
AC × 1
AC × 37
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 02_medium_00.txt, 02_medium_01.txt, 02_medium_02.txt, 02_medium_03.txt, 02_medium_04.txt, 02_medium_05.txt, 02_medium_06.txt, 02_medium_07.txt, 02_medium_08.txt, 02_medium_09.txt, 02_medium_10.txt, 02_medium_11.txt, 02_medium_12.txt, 03_random_00.txt, 03_random_01.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 04_corner_00.txt, 04_corner_01.txt, 04_corner_02.txt, 04_corner_03.txt, 04_corner_04.txt, 04_corner_05.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3480 KiB
01_small_00.txt AC 22 ms 3596 KiB
01_small_01.txt AC 22 ms 3496 KiB
01_small_02.txt AC 22 ms 3676 KiB
01_small_03.txt AC 22 ms 3496 KiB
01_small_04.txt AC 22 ms 3616 KiB
01_small_05.txt AC 22 ms 3676 KiB
01_small_06.txt AC 13 ms 3496 KiB
02_medium_00.txt AC 31 ms 3584 KiB
02_medium_01.txt AC 29 ms 3636 KiB
02_medium_02.txt AC 28 ms 3596 KiB
02_medium_03.txt AC 26 ms 3548 KiB
02_medium_04.txt AC 27 ms 3636 KiB
02_medium_05.txt AC 28 ms 3572 KiB
02_medium_06.txt AC 25 ms 3584 KiB
02_medium_07.txt AC 21 ms 3676 KiB
02_medium_08.txt AC 18 ms 3528 KiB
02_medium_09.txt AC 27 ms 3604 KiB
02_medium_10.txt AC 24 ms 3596 KiB
02_medium_11.txt AC 20 ms 3748 KiB
02_medium_12.txt AC 17 ms 3612 KiB
03_random_00.txt AC 19 ms 4160 KiB
03_random_01.txt AC 21 ms 4116 KiB
03_random_02.txt AC 19 ms 4296 KiB
03_random_03.txt AC 18 ms 4216 KiB
03_random_04.txt AC 21 ms 4100 KiB
03_random_05.txt AC 12 ms 4744 KiB
03_random_06.txt AC 26 ms 5560 KiB
03_random_07.txt AC 27 ms 5132 KiB
03_random_08.txt AC 26 ms 5324 KiB
03_random_09.txt AC 26 ms 4992 KiB
04_corner_00.txt AC 15 ms 7188 KiB
04_corner_01.txt AC 13 ms 7216 KiB
04_corner_02.txt AC 14 ms 8128 KiB
04_corner_03.txt AC 14 ms 8084 KiB
04_corner_04.txt AC 14 ms 7148 KiB
04_corner_05.txt AC 14 ms 7180 KiB