Submission #340275

# Submission time Handle Problem Language Result Execution time Memory
340275 2020-12-27T11:22:50 Z ammar2000 Preokret (COCI19_preokret) C++17
44 / 50
1 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
int n,a,b,in[500],t,lws=1,ans;
int main()
{
 cin>>n;
 for (int i=0;i<n;i++)
 {
     cin>>in[i];
     if (in[i]==1)
        a++;
     else b++;
     if (a==b)
        t++;
     if (a&&b)
        {if (in[i]==in[i-1])
     {
         lws++;
     }
     else
     {
         ans=max(ans,lws);
         lws=1;
     }}
     if (a&&b)
        ans=max(ans,lws);
 }
 cout<<a<<" "<<b<<"\n";
 cout <<t+1<<"\n"<<ans;
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 376 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Partially correct 1 ms 364 KB Output is partially correct
8 Correct 1 ms 364 KB Output is correct
9 Partially correct 1 ms 364 KB Output is partially correct
10 Correct 1 ms 364 KB Output is correct