86342024-01-24 11:13:17bovizdbTúlcsorduláspypy3Runtime error 0/10081ms90144 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define endl "\n"
#define pll pair<ll, ll>
#define fs first
#define sc second
#define vll vector<ll>
#define v2d vector<vector<ll>>
#define vpll vector<pll>
#define qll queue<ll>
#define stll stack<ll>
#define sll set<ll>
#define mll map<ll, ll>

ll n, q;
string a, b;

bool func(string s1, string s2)
{
    for (ll i = 0; i < s1.size(); i++)
    {
        if (s1[i] == '1' && s2[i] == '1') return false;
        if (s1[i] == '0' && s2[i] == '0') return true;
    }
    
    return true;
}

void solve()
{
    cin >> n >> a >> b;
    cin >> q;
    vector<bool> out(q);
    for (ll i = 0; i < q; i++)
    {
        ll x, y, l;
        cin >> x >> y >> l;
        string s1 = a.substr(x, l), s2= b.substr(y, l);
        if (func(s1, s2) == true) cout << 1 << endl;
        else cout << 0 << endl;
    }
}
 
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Runtime error68ms87396 KiB
2Runtime error64ms87612 KiB
subtask20/40
3Runtime error64ms88016 KiB
4Runtime error64ms88532 KiB
5Runtime error64ms88628 KiB
6Runtime error64ms88660 KiB
7Runtime error64ms88740 KiB
8Runtime error64ms88856 KiB
9Runtime error64ms88924 KiB
subtask30/30
10Runtime error64ms88812 KiB
11Runtime error64ms88656 KiB
12Runtime error74ms89220 KiB
13Runtime error68ms89628 KiB
14Runtime error64ms89548 KiB
15Runtime error64ms89824 KiB
16Runtime error65ms89844 KiB
17Runtime error64ms89724 KiB
subtask40/30
18Runtime error64ms89720 KiB
19Runtime error64ms89944 KiB
20Runtime error64ms89920 KiB
21Runtime error64ms89996 KiB
22Runtime error64ms89936 KiB
23Runtime error65ms90100 KiB
24Runtime error81ms90060 KiB
25Runtime error68ms89996 KiB
26Runtime error64ms89908 KiB
27Runtime error64ms90144 KiB
28Runtime error64ms90052 KiB