/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 4ms 532.0 KiB

Code

// Link ->
// Author -> Efat Sikder, IUBAT
#include "bits/stdc++.h"
using namespace std;

typedef long long int ll;
typedef unsigned long long l1;
typedef double db;

#define pi acos(-1)
#define prDouble(x, y) fixed << setprecision(y) << x
#define lcm(a, b) ((a * b) / __gcd(a, b))
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define mm(x, v) memset((x), v, sizeof(x));
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define nl << "\n"
#define debug(x) cout << #x << " = " << x nl
#define casePrint(ans, cn) cout << "Case " << cn << ": " << ans nl

void solve(int caseNumber)
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    s += '1';
    int ans = 0;
    int zeroCnt = 0;
    for (int i = 0; i <= n; i++)
    {
        if (s[i] == '0')
        {
            zeroCnt++;
        }
        else
        {
            ans = max(ans, zeroCnt);
            zeroCnt = 0;
        }
    }
    cout << ans nl;
}

void init_code()
{
    fast_io;

}

signed main()
{
    init_code();
    int testcase = 1;
    cin >> testcase;
    for (int caseNumber = 1; caseNumber <= testcase; ++caseNumber)
    {
        solve(caseNumber);
    }
    return 0;
}

Information

Submit By
Type
Pretest
Problem
P1113 Fliping Game
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-05 14:43:10
Judged At
2024-11-05 14:43:10
Judged By
Score
10
Total Time
4ms
Peak Memory
532.0 KiB