8636 | 2024-01-24 11:15:39 | bovizdb | Túlcsordulás | cpp17 | Wrong answer 0/100 | 1.083s | 6424 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1824 KiB | ||||
2 | Accepted | 3ms | 2064 KiB | ||||
subtask2 | 0/40 | ||||||
3 | Accepted | 3ms | 2272 KiB | ||||
4 | Accepted | 3ms | 2484 KiB | ||||
5 | Wrong answer | 4ms | 2668 KiB | ||||
6 | Accepted | 3ms | 2912 KiB | ||||
7 | Accepted | 4ms | 3124 KiB | ||||
8 | Wrong answer | 7ms | 3208 KiB | ||||
9 | Wrong answer | 6ms | 3460 KiB | ||||
subtask3 | 0/30 | ||||||
10 | Accepted | 3ms | 3156 KiB | ||||
11 | Wrong answer | 30ms | 3744 KiB | ||||
12 | Time limit exceeded | 1.083s | 3224 KiB | ||||
13 | Time limit exceeded | 1.07s | 3376 KiB | ||||
14 | Time limit exceeded | 1.062s | 3884 KiB | ||||
15 | Time limit exceeded | 1.065s | 4232 KiB | ||||
16 | Time limit exceeded | 1.072s | 4092 KiB | ||||
17 | Time limit exceeded | 1.082s | 4104 KiB | ||||
subtask4 | 0/30 | ||||||
18 | Wrong answer | 10ms | 4108 KiB | ||||
19 | Wrong answer | 582ms | 6424 KiB | ||||
20 | Wrong answer | 321ms | 4956 KiB | ||||
21 | Time limit exceeded | 1.078s | 4452 KiB | ||||
22 | Time limit exceeded | 1.057s | 4592 KiB | ||||
23 | Time limit exceeded | 1.07s | 4588 KiB | ||||
24 | Time limit exceeded | 1.036s | 4564 KiB | ||||
25 | Time limit exceeded | 1.074s | 4556 KiB | ||||
26 | Time limit exceeded | 1.065s | 4656 KiB | ||||
27 | Time limit exceeded | 1.078s | 4876 KiB | ||||
28 | Time limit exceeded | 1.075s | 5028 KiB |