Submission #692547

#TimeUsernameProblemLanguageResultExecution timeMemory
692547delreyPreokret (COCI19_preokret)C++14
50 / 50
1 ms340 KiB
#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 timeMemoryGrader output
Fetching results...