All pastes #732935 Raw Edit

Someone

public cpp v1 · immutable
·published 2007-10-11 12:10 UTC
rendered paste body
#include <iostream>#include <string>#include <list>using namespace std;int main(){  for(int i = 0; i < 10; ++i) {    string s;    int maxDepth = 0, maxCount = 0, count = 0, n, depth = 0;    list<bool> status;    cin >> n >> s;    for(int j = 0; j < s.size(); ++j) {      if(s[j] == '0' && depth != 0) {        if(depth > maxDepth)          maxDepth = depth, maxCount = count;        while(--depth && status.back())          status.pop_back();        status.back() = true;        continue;      }      ++count, ++depth;      status.push_back(false);    }    cout << maxCount << endl;  }}