Submission #75076956


Source Code Expand

#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <unordered_map>
#include <map>
#include <queue>
#include <unordered_set>
#include <cassert>
#include <list>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numbers>
#include <iostream>
#include <string>
#include <random>

using namespace std;

#define fori(n)for (int i = 0; i < n; i++)
#define fo(n)for (int i = 0; i < n; i++)
#define fori1(n)for (ll i = 1; i < n + 1; i++)
#define revi1(n)for (int i = n; i >=0; i--)
#define forj(n)for (ll j = 0; j < (n); j++)
#define rep(i, n)for (ll i = 0; i < (n); i++)
#define repj(i, j, n)for (ll i = j; i < (n); i++)
#define forj1(n)for (ll j = 1; j < n+1; j++)
#define revj1(n)for (ll j = n; j >=0; j--)
#define revi(n)for (int i = n-1; i >= 0; i--)
#define ll long long
#define ull unsigned ll
#define MAXN (2147483647)
#define MINN (-2147483648)
#define ffast_io ios::sync_with_stdio(false);\
                 cout.tie(nullptr); cin.tie(nullptr)

string svo(bool fl) {
    if (fl)
        return "YES";
    return "NO";
}

vector<vector<ll>> multi(vector<vector<ll>> a, vector<vector<ll>> b) {
    vector<vector<ll>> res(a.size(), vector<ll>(b[0].size(), 0));
    fori(a.size()) {
        forj(b[0].size()) {
            ll temp = 0;
            rep(k, b.size())temp = (temp + (a[i][k] * b[k][j]) % 1000000007l) % 1000000007;
            res[i][j] = temp;
        }
    }
    return res;
}

vector<vector<ll>> pow(const vector<vector<ll>> &mat, int powred) {
    if (powred == 1) return mat;
    if (powred % 2 == 1) return multi(pow(mat, powred - 1), mat);
    vector<vector<ll>> temp = pow(multi(mat, mat), powred / 2);
    return temp;
}

ll pow1(ll mat, ll powred) {
    if (powred == 1L) return mat;
    if ((powred % 2LL) == 1LL) return (pow1(mat, powred - 1LL) * mat) % 10LL;
    auto temp = pow1((mat * mat) % 10LL, powred / 2LL);
    return temp;
}

template<typename T>
void debug(const std::vector<T> &ttt, std::ostream &out = std::cout) {
    int temp = 1;
    for (auto it = ttt.begin(); it != ttt.end(); ++it, temp++) out << *it << ' ';
    out << std::endl;
}

template<typename T>
void debug(const std::vector<vector<T>> &ttt, std::ostream &out = std::cout) {
    for (int it = 0; it != ttt.size(); ++it) debug(ttt[it]);
}

template<typename T>
void debug(set<T> ttt, std::ostream &out = std::cout) {
    for (auto t: ttt) out << t << " ";
    out << endl;
}

void debug(bool k, std::ostream &out = std::cout) { if (k) out << "yes"; else out << "no"; }

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,tune=native")


std::vector<int> prefix_function(const std::string &s) {
    int n = s.size();
    std::vector<int> pi(n);
    for (int i = 1; i < n; ++i) {
        int j = pi[i - 1];
        while (j > 0 && s[i] != s[j])
            j = pi[j - 1];
        if (s[i] == s[j]) ++j;
        pi[i] = j;
    }
    return pi;
}

string getsome(string &s) {
    vector<char> st;

    for (char c: s) {
        st.push_back(c);

        while (st.size() >= 4 &&
      st[st.size() - 4] == '(' &&
        st[st.size() - 3] == 'x' &&
               st[st.size() - 2] == 'x' &&
               st[st.size() - 1] == ')') {
            st.pop_back();st.pop_back();st.pop_back();st.pop_back();
            st.push_back('x');st.push_back('x');
        }
    }

    return {st.begin(), st.end()};
}

void solve() {
    int q;
    cin >> q;
    while (q--) {
        string a, b;
        cin >> a >> b;
        auto a_ = getsome(a);
        auto b_ = getsome(b);
        if (a_ == b_) {
            cout << "Yes" << "\n";
        } else {
            cout << "No" << "\n";
        }

    }
}

int main() {
    ffast_io;

    solve();


    return 0;
}

Submission Info

Submission Time
Task D - (xx)
User kashapoV
Language C++23 (GCC 15.2.0)
Score 425
Code Size 4013 Byte
Status AC
Exec Time 66 ms
Memory 7256 KiB

Compile Error

./Main.cpp: In function 'std::vector<std::vector<long long int> > multi(std::vector<std::vector<long long int> >, std::vector<std::vector<long long int> >)':
./Main.cpp:26:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 | #define fori(n)for (int i = 0; i < n; i++)
      |                                  ^
./Main.cpp:51:5: note: in expansion of macro 'fori'
   51 |     fori(a.size()) {
      |     ^~~~
./Main.cpp:30:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 | #define forj(n)for (ll j = 0; j < (n); j++)
      |                               ~~^~~~~
./Main.cpp:52:9: note: in expansion of macro 'forj'
   52 |         forj(b[0].size()) {
      |         ^~~~
./Main.cpp:31:35: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 | #define rep(i, n)for (ll i = 0; i < (n); i++)
      |                                   ^
./Main.cpp:54:13: note: in expansion of macro 'rep'
   54 |             rep(k, b.size())temp = (temp + (a[i][k] * b[k][j]) % 1000000007l) % 1000000007;
      |             ^~~

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 1 ms 3528 KiB
01_small_00.txt AC 57 ms 3612 KiB
01_small_01.txt AC 57 ms 3528 KiB
01_small_02.txt AC 56 ms 3464 KiB
01_small_03.txt AC 56 ms 3468 KiB
01_small_04.txt AC 56 ms 3468 KiB
01_small_05.txt AC 57 ms 3604 KiB
01_small_06.txt AC 33 ms 3512 KiB
02_medium_00.txt AC 66 ms 3512 KiB
02_medium_01.txt AC 61 ms 3620 KiB
02_medium_02.txt AC 57 ms 3564 KiB
02_medium_03.txt AC 53 ms 3456 KiB
02_medium_04.txt AC 51 ms 3512 KiB
02_medium_05.txt AC 60 ms 3448 KiB
02_medium_06.txt AC 49 ms 3452 KiB
02_medium_07.txt AC 38 ms 3624 KiB
02_medium_08.txt AC 30 ms 3692 KiB
02_medium_09.txt AC 49 ms 3604 KiB
02_medium_10.txt AC 41 ms 3468 KiB
02_medium_11.txt AC 34 ms 3564 KiB
02_medium_12.txt AC 30 ms 3580 KiB
03_random_00.txt AC 24 ms 4040 KiB
03_random_01.txt AC 25 ms 4008 KiB
03_random_02.txt AC 25 ms 4352 KiB
03_random_03.txt AC 23 ms 4000 KiB
03_random_04.txt AC 25 ms 4000 KiB
03_random_05.txt AC 14 ms 4700 KiB
03_random_06.txt AC 28 ms 5564 KiB
03_random_07.txt AC 28 ms 5368 KiB
03_random_08.txt AC 28 ms 5324 KiB
03_random_09.txt AC 27 ms 5008 KiB
04_corner_00.txt AC 28 ms 6128 KiB
04_corner_01.txt AC 28 ms 6216 KiB
04_corner_02.txt AC 28 ms 7140 KiB
04_corner_03.txt AC 29 ms 7256 KiB
04_corner_04.txt AC 28 ms 6056 KiB
04_corner_05.txt AC 27 ms 6128 KiB