86352024-01-24 11:14:17bovizdbTúlcsorduláscpp17Wrong answer 0/1001.1s6332 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
1Wrong answer3ms1832 KiB
2Wrong answer3ms2016 KiB
subtask20/40
3Wrong answer3ms2248 KiB
4Wrong answer3ms2448 KiB
5Wrong answer4ms2664 KiB
6Wrong answer3ms3032 KiB
7Wrong answer4ms3508 KiB
8Wrong answer7ms3620 KiB
9Wrong answer4ms3560 KiB
subtask30/30
10Wrong answer3ms3480 KiB
11Wrong answer30ms3792 KiB
12Time limit exceeded1.1s3248 KiB
13Time limit exceeded1.1s3396 KiB
14Time limit exceeded1.06s4264 KiB
15Time limit exceeded1.062s4128 KiB
16Time limit exceeded1.082s4296 KiB
17Time limit exceeded1.069s4480 KiB
subtask40/30
18Wrong answer10ms4200 KiB
19Wrong answer586ms6332 KiB
20Wrong answer321ms4880 KiB
21Time limit exceeded1.072s4428 KiB
22Time limit exceeded1.062s4568 KiB
23Time limit exceeded1.062s5040 KiB
24Time limit exceeded1.074s4868 KiB
25Time limit exceeded1.047s4740 KiB
26Time limit exceeded1.065s5060 KiB
27Time limit exceeded1.05s5092 KiB
28Time limit exceeded1.062s5108 KiB