8635 | 2024-01-24 11:14:17 | bovizdb | Túlcsordulás | cpp17 | Wrong answer 0/100 | 1.1s | 6332 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 | Wrong answer | 3ms | 1832 KiB | ||||
2 | Wrong answer | 3ms | 2016 KiB | ||||
subtask2 | 0/40 | ||||||
3 | Wrong answer | 3ms | 2248 KiB | ||||
4 | Wrong answer | 3ms | 2448 KiB | ||||
5 | Wrong answer | 4ms | 2664 KiB | ||||
6 | Wrong answer | 3ms | 3032 KiB | ||||
7 | Wrong answer | 4ms | 3508 KiB | ||||
8 | Wrong answer | 7ms | 3620 KiB | ||||
9 | Wrong answer | 4ms | 3560 KiB | ||||
subtask3 | 0/30 | ||||||
10 | Wrong answer | 3ms | 3480 KiB | ||||
11 | Wrong answer | 30ms | 3792 KiB | ||||
12 | Time limit exceeded | 1.1s | 3248 KiB | ||||
13 | Time limit exceeded | 1.1s | 3396 KiB | ||||
14 | Time limit exceeded | 1.06s | 4264 KiB | ||||
15 | Time limit exceeded | 1.062s | 4128 KiB | ||||
16 | Time limit exceeded | 1.082s | 4296 KiB | ||||
17 | Time limit exceeded | 1.069s | 4480 KiB | ||||
subtask4 | 0/30 | ||||||
18 | Wrong answer | 10ms | 4200 KiB | ||||
19 | Wrong answer | 586ms | 6332 KiB | ||||
20 | Wrong answer | 321ms | 4880 KiB | ||||
21 | Time limit exceeded | 1.072s | 4428 KiB | ||||
22 | Time limit exceeded | 1.062s | 4568 KiB | ||||
23 | Time limit exceeded | 1.062s | 5040 KiB | ||||
24 | Time limit exceeded | 1.074s | 4868 KiB | ||||
25 | Time limit exceeded | 1.047s | 4740 KiB | ||||
26 | Time limit exceeded | 1.065s | 5060 KiB | ||||
27 | Time limit exceeded | 1.05s | 5092 KiB | ||||
28 | Time limit exceeded | 1.062s | 5108 KiB |