# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
692547 | delrey | Preokret (COCI19_preokret) | C++14 | 1 ms | 340 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 <bits/stdc++.h>
using namespace std;
int main()
{
int n, a;
cin>>n;
int goalsCity = 0, goalsOpp = 0, ties = 1, streak = 0, prev = 0, lead = 0, streakMax = 0;
for(int i = 0; i < n; i++)
{
cin>>a;
if(a == prev)
streak++;
else
{
streak = 1;
if(goalsCity > goalsOpp)
lead = 1;
else if(goalsCity < goalsOpp)
lead = 2;
else
lead = 0;
}
if(a == 1)
goalsCity++;
else
goalsOpp++;
if(goalsCity > goalsOpp && lead == 2)
streakMax = max(streak, streakMax);
if(goalsCity < goalsOpp && lead == 1)
streakMax = max(streak, streakMax);
if(goalsCity == goalsOpp)
ties++;
prev = a;
}
cout<<goalsCity<<" "<<goalsOpp<<endl;
cout<<ties<<endl;
cout<<streakMax<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |