/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 4ms 580.0 KiB
#3 Accepted 2ms 328.0 KiB
#4 Accepted 2ms 576.0 KiB
#5 Accepted 2ms 580.0 KiB
#6 Accepted 2ms 740.0 KiB
#7 Accepted 2ms 836.0 KiB
#8 Accepted 2ms 696.0 KiB

Code

#ifndef LOCAL
#include <bits/stdc++.h>
#define debug(...)
#endif

using namespace std;
#define int long long
#define cinv(v) for (auto &it:v) cin>>it;
#define coutv(v) for (auto &it:v) cout<< it<<' '; cout<<'\n';

void shelby() {
    int n;
    string s;
    cin >> n >> s;
    int ans = 0, now = 0;
    for (auto &it: s) {
        if (it == '1') {
            ans = max(ans, now);
            now = 0;
        }
        else now++;
        debug(ans, it, now);
    }
    ans = max(ans, now);
    cout << ans << '\n';
}

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    cin >> t;
    for (int _ = 1; _ <= t; ++_) {
        // cout << "Case " << _ << ": ";
        shelby();
    }
}

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 14:39:31
Judged At
2024-11-11 02:32:54
Judged By
Score
100
Total Time
4ms
Peak Memory
836.0 KiB