Submission #75063860


Source Code Expand

// Date: 2026-04-18
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
    bool debug_mode = 1;
#else
    bool debug_mode = 0;
#endif

using ll = long long;
#define cerr if(debug_mode) cerr

int main() {
    cin.tie(0) -> sync_with_stdio(0);
    
    int t; cin >> t;

    auto minimizer = [](string s) -> string {
        int n = s.size();

        vector<int> stk;
        vector<bool> should_remove(n);
        int diff = 0;
        bool valid = 0;
        for (int i = 0; i < n; i++) {
            if (s[i] == 'x') {}

            else if (s[i] == '(') {
                stk.emplace_back(i);
                diff = 0;
                valid = 1;
            }

            else if (s[i] == ')') {
                if (valid && stk.size() && i - diff - stk.back() == 3) {
                    diff += 2;
                    should_remove[stk.back()] = 1;
                    stk.pop_back();
                    should_remove[i] = 1;
                } else {
                    valid = 0;
                }
            }

            else assert(0);
        }

        string res = "";
        for (int i = 0; i < n; i++) {
            if (should_remove[i]) continue;
            
            res += s[i];
        }

        return res;
    };

    auto solve = [&]() -> void {
        string a, b; cin >> a >> b;

        int n = a.size(), m = b.size();

        string res_a = minimizer(a), res_b = minimizer(b);
        cerr << res_a << ' ' << res_b << '\n';

        cout << (res_a == res_b ? "Yes\n" : "No\n");
    };

    while (t--) solve();
}

Submission Info

Submission Time
Task D - (xx)
User Emmetthor
Language C++ IOI-Style(GNU++20) (GCC 14.2.0)
Score 425
Code Size 1629 Byte
Status AC
Exec Time 50 ms
Memory 11148 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 425 / 425
Status
AC × 1
AC × 37
Set Name Test Cases
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
Case Name Status Exec Time Memory
00_sample_00.txt AC 0 ms 1776 KiB
01_small_00.txt AC 35 ms 1776 KiB
01_small_01.txt AC 35 ms 1776 KiB
01_small_02.txt AC 34 ms 1776 KiB
01_small_03.txt AC 35 ms 1776 KiB
01_small_04.txt AC 35 ms 1776 KiB
01_small_05.txt AC 35 ms 1776 KiB
01_small_06.txt AC 20 ms 1776 KiB
02_medium_00.txt AC 50 ms 1776 KiB
02_medium_01.txt AC 47 ms 1776 KiB
02_medium_02.txt AC 44 ms 1776 KiB
02_medium_03.txt AC 42 ms 1776 KiB
02_medium_04.txt AC 41 ms 1776 KiB
02_medium_05.txt AC 38 ms 1776 KiB
02_medium_06.txt AC 33 ms 1776 KiB
02_medium_07.txt AC 24 ms 1776 KiB
02_medium_08.txt AC 18 ms 1776 KiB
02_medium_09.txt AC 26 ms 1776 KiB
02_medium_10.txt AC 24 ms 1776 KiB
02_medium_11.txt AC 18 ms 1776 KiB
02_medium_12.txt AC 15 ms 1776 KiB
03_random_00.txt AC 13 ms 2944 KiB
03_random_01.txt AC 14 ms 3012 KiB
03_random_02.txt AC 13 ms 3004 KiB
03_random_03.txt AC 13 ms 2908 KiB
03_random_04.txt AC 14 ms 2800 KiB
03_random_05.txt AC 7 ms 3620 KiB
03_random_06.txt AC 14 ms 4236 KiB
03_random_07.txt AC 14 ms 4292 KiB
03_random_08.txt AC 15 ms 4288 KiB
03_random_09.txt AC 14 ms 4024 KiB
04_corner_00.txt AC 12 ms 8816 KiB
04_corner_01.txt AC 11 ms 8816 KiB
04_corner_02.txt AC 11 ms 11148 KiB
04_corner_03.txt AC 11 ms 11148 KiB
04_corner_04.txt AC 11 ms 8816 KiB
04_corner_05.txt AC 11 ms 8816 KiB