/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 13ms 576.0 KiB
#3 Accepted 5ms 532.0 KiB
#4 Accepted 4ms 532.0 KiB
#5 Accepted 4ms 532.0 KiB
#6 Accepted 6ms 696.0 KiB
#7 Accepted 6ms 788.0 KiB
#8 Accepted 6ms 692.0 KiB

Code

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
using ll = long long;

int main() {
  FAST;
  
  int tc = 1, ti;
  cin >> tc;

  for (ti = 1; ti <= tc; ++ti) {
    int n, i, j, ans;
    string s;
    cin >> n >> s;

    ans = 0;
    for (i = 0; i < n; ++i) {
      if (s[i] == '1') continue;
      for (j = i+1; j < n; ++j) {
        if (s[j] == '1') break;
      }
      ans = max(ans, j-i);
      i = j-1;
    }

    cout << ans << "\n";
  }

  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 14:45:50
Judged At
2024-11-05 14:45:50
Judged By
Score
100
Total Time
13ms
Peak Memory
788.0 KiB