/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 25ms 532.0 KiB
#3 Accepted 6ms 532.0 KiB
#4 Accepted 4ms 556.0 KiB
#5 Accepted 17ms 532.0 KiB
#6 Accepted 16ms 748.0 KiB
#7 Accepted 17ms 904.0 KiB
#8 Accepted 17ms 680.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define ull unsigned long long
#define vecint vector<int>
#define vecchar vector<char>
#define un_set unordered_set
#define un_map unordered_map
#define max_ele(v) *max_element(v.begin(), v.end())
#define min_ele(v) *min_element(v.begin(), v.end())
#define sort_asc(v) sort(v.begin(), v.end())
#define sort_dec(v) sort((v).begin(), (v).end(), greater<>())
#define Reverse(v) reverse(v.begin(), v.end())
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define coutall(v)     \
    for (auto &it : v) \
    cout << it << " "
#define coutnewline(v) \
    for (auto &it : v) \
    cout << it << '\n'
#define cinall(v)      \
    for (auto &it : v) \
    cin >> it
#define yes cout << "YES\n"
#define no cout << "NO\n"

constexpr char nl = '\n';

void solucionar()
{
    int n, count = 0, max_ind = 0;
    cin >> n;
    string ch;
    cin >> ch;
    for (int i = 0; i < n; i++)
    {
        if (ch[i] == '0')
        {
            count++;
            if (i == n - 1)
            {
                max_ind = max(max_ind, count);
                count = 0;
            }
        }
        else
        {
            max_ind = max(max_ind, count);
            count = 0;
        }
    }
    cout << max_ind << endl;
}

int main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(0);

    int tests;
    cin >> tests;
    while (tests-- > 0)
    {
        solucionar();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1113 Fliping Game
Contest
Brain Booster #7
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-05 15:35:07
Judged At
2024-11-05 15:35:07
Judged By
Score
100
Total Time
25ms
Peak Memory
904.0 KiB