Comments

void solve() {

ll n;
cin >> n;
string s1, s2;
cin >> s1 >> s2;
if (s2[n - 2] != '>') {
    cout << no << endl;
    return;
}
ll tem1 = -1;
bool x = false;
for (int i = 0; i < n; i += 2) {
    if (s1[i] == '<') {
        x=true;
        break;
    }
}
if (!x) {
    cout << yes << endl;
    return;
}
for (int i = 1; i < n; i += 2) {
    if (s1[i] == '>') {
        tem1 = i;
    }
    else {
        break;
    }
}
for (int i = tem1 + 1; i < n; i += 2) {
    if (s2[i] != '>') {
        cout << no << endl;
        return;
    }
}
cout << yes << endl;

}

[submission:251541342]Please tell me why my C is wrong

void solve() {

ll n, q;
cin >> n >> q;
vector<ll>a(n + 1);
for (int i = 1; i <= n; i++) {
    cin >> a[i];
}
vector<ll>b(n + 1, 0);
for (int i = 1; i <= n; i++) {
    b[i] = a[i] + b[i - 1];
}
while (q--) {
    ll l, r;
    cin >> l >> r;
    if (l == r) {
        cout << no << endl;
        continue;
    }
    ll tem = b[r] - b[l - 1];
    ll h = r - l + 1;
    if (tem >= h / 2 + (h - h / 2) * 2) {
        cout << yes << endl;
    }
    else {
        cout << no << endl;
    }
}

}

Can anyone find out the my mistake Thanks[submission:247947411]