All pastes #732933 Raw Edit

Mine

public cpp v1 · immutable
·published 2007-10-11 12:06 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 > 0 && status.back())        {          --depth;          status.pop_back();        }        status.back() = true;        continue;      }      ++count, ++depth;      status.push_back(false);    }    cout << maxCount << endl;  }}