8634 | 2024-01-24 11:13:17 | bovizdb | Túlcsordulás | pypy3 | Runtime error 0/100 | 81ms | 90144 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Runtime error | 68ms | 87396 KiB | ||||
2 | Runtime error | 64ms | 87612 KiB | ||||
subtask2 | 0/40 | ||||||
3 | Runtime error | 64ms | 88016 KiB | ||||
4 | Runtime error | 64ms | 88532 KiB | ||||
5 | Runtime error | 64ms | 88628 KiB | ||||
6 | Runtime error | 64ms | 88660 KiB | ||||
7 | Runtime error | 64ms | 88740 KiB | ||||
8 | Runtime error | 64ms | 88856 KiB | ||||
9 | Runtime error | 64ms | 88924 KiB | ||||
subtask3 | 0/30 | ||||||
10 | Runtime error | 64ms | 88812 KiB | ||||
11 | Runtime error | 64ms | 88656 KiB | ||||
12 | Runtime error | 74ms | 89220 KiB | ||||
13 | Runtime error | 68ms | 89628 KiB | ||||
14 | Runtime error | 64ms | 89548 KiB | ||||
15 | Runtime error | 64ms | 89824 KiB | ||||
16 | Runtime error | 65ms | 89844 KiB | ||||
17 | Runtime error | 64ms | 89724 KiB | ||||
subtask4 | 0/30 | ||||||
18 | Runtime error | 64ms | 89720 KiB | ||||
19 | Runtime error | 64ms | 89944 KiB | ||||
20 | Runtime error | 64ms | 89920 KiB | ||||
21 | Runtime error | 64ms | 89996 KiB | ||||
22 | Runtime error | 64ms | 89936 KiB | ||||
23 | Runtime error | 65ms | 90100 KiB | ||||
24 | Runtime error | 81ms | 90060 KiB | ||||
25 | Runtime error | 68ms | 89996 KiB | ||||
26 | Runtime error | 64ms | 89908 KiB | ||||
27 | Runtime error | 64ms | 90144 KiB | ||||
28 | Runtime error | 64ms | 90052 KiB |