| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 51212 | robert | Orchard (NOI14_orchard) | C++14 | 203 ms | 740 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
int main(){
	int N, M; cin>>N>>M;
	int f[160][5100];
	int cur = 0, toto = 0, maxs = 0, len = 0, curl=0, curo = 0;
	int o =0;
	int a;
	for(int x=0; x<M; x++){
		cin>>a;
		curl++;
		if(a==1){
			curo++;
			cur++;
			toto++;
		} else {
			cur--;
		}
		if(cur<0)
			cur = curl = curo = 0;
		if(cur>maxs){
			maxs = cur;
			o=curo;
			len = curl;
		}
	}
//	cout << toto << " " << o << endl;
	cout << toto-o + (len-o) << endl;
	return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
