86362024-01-24 11:15:39bovizdbTúlcsorduláscpp17Wrong answer 0/1001.083s6424 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 << " ";
        else cout << 0 << " ";
    }
}
 
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
1Accepted3ms1824 KiB
2Accepted3ms2064 KiB
subtask20/40
3Accepted3ms2272 KiB
4Accepted3ms2484 KiB
5Wrong answer4ms2668 KiB
6Accepted3ms2912 KiB
7Accepted4ms3124 KiB
8Wrong answer7ms3208 KiB
9Wrong answer6ms3460 KiB
subtask30/30
10Accepted3ms3156 KiB
11Wrong answer30ms3744 KiB
12Time limit exceeded1.083s3224 KiB
13Time limit exceeded1.07s3376 KiB
14Time limit exceeded1.062s3884 KiB
15Time limit exceeded1.065s4232 KiB
16Time limit exceeded1.072s4092 KiB
17Time limit exceeded1.082s4104 KiB
subtask40/30
18Wrong answer10ms4108 KiB
19Wrong answer582ms6424 KiB
20Wrong answer321ms4956 KiB
21Time limit exceeded1.078s4452 KiB
22Time limit exceeded1.057s4592 KiB
23Time limit exceeded1.07s4588 KiB
24Time limit exceeded1.036s4564 KiB
25Time limit exceeded1.074s4556 KiB
26Time limit exceeded1.065s4656 KiB
27Time limit exceeded1.078s4876 KiB
28Time limit exceeded1.075s5028 KiB