1902A - Binary Imbalance - CodeForces Solution


constructive algorithms

Please click on ads to support us..

C++ Code:

#include <bits/stdc++.h>
    #include <iostream>
    using namespace std;
    #define sz(x) ((int)(x).size())
    #define all(x) (x).begin(), (x).end()
    #define forr(i, a) for (int i = 0; i < (a); ++i)
    #define forc(i, a) for (int i = 1; i <= (a); ++i)
    #define fora(i, a, b) for (int i = (a); i <= (b); ++i)
    #define fore(it, x) for (auto &it : (x))
    #define range(i, a, b, c) for (int i = (a); (c) > 0 ? i <= (b) : i >= (b); i += (c))
    #define sum(v,r) fore(i,(v)) r+=i
    #define res(v,r) fore(i,(v)) r-=i
    #define mul(v,r) fore(i,(v)) r*=i
    #define div(v,r) fore(i,(v)) r/=i
    #define mtx(m,a,b) vector<int[(a)]> m(b) 
    #define pb push_back
    #define pob pop_back
    #define emb emplace_back
    #define mak make_pair
    #define mkt make_tuple
    typedef long long ll;
    typedef long double ld;
    inline bool sol(){
        int t;cin>>t;string s;cin>>s;
        forr(u,t) {
            if(!(int(s[u])-'0')){return true;}
        }
        return false;
    }
    int main(){
        int l;scanf("%d",&l);
        while(l--){
            if(sol()){puts("YES");}else{puts("NO");}
        }
    }


Comments

Submit
0 Comments
More Questions

230A - Dragons
200B - Drinks
13A - Numbers
129A - Cookies
1367B - Even Array
136A - Presents
1450A - Avoid Trygub
327A - Flipping Game
411A - Password Check
1520C - Not Adjacent Matrix
1538B - Friends and Candies
580A - Kefa and First Steps
1038B - Non-Coprime Partition
43A - Football
50A - Domino piling
479A - Expression
1480A - Yet Another String Game
1216C - White Sheet
1648A - Weird Sum
427A - Police Recruits
535A - Tavas and Nafas
581A - Vasya the Hipster
1537B - Bad Boy
1406B - Maximum Product
507B - Amr and Pins
379A - New Year Candles
1154A - Restoring Three Numbers
750A - New Year and Hurry
705A - Hulk
492B - Vanya and Lanterns