/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 712.0 KiB
#2 Accepted 7ms 540.0 KiB
#3 Accepted 4ms 564.0 KiB
#4 Accepted 4ms 716.0 KiB
#5 Accepted 3ms 612.0 KiB
#6 Accepted 3ms 748.0 KiB
#7 Accepted 3ms 748.0 KiB
#8 Accepted 3ms 772.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-11 02:32:35
Judged By
Score
100
Total Time
7ms
Peak Memory
772.0 KiB