Submission #685171

#TimeUsernameProblemLanguageResultExecution timeMemory
685171Farhan_HYPreokret (COCI19_preokret)C++14
50 / 50
1 ms328 KiB
#include <bits/stdc++.h> #define int long long #define F first #define S second #define T int t; cin >> t; while(t--) #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; const int N = 205; const int M = 1e3 + 3; const int inf = 1e18; const int mod = 1e9 + 7; int n, team1, team2; main() { IOS cin >> n; int cnt1 = 0, cnt2 = 0, mx = 0, tie = 1; for(int i = 1; i <= n; i++) { int x; cin >> x; if (x == 1) { cnt1++; cnt2 = 0; team1++; if (team1 > team2 && team1 - cnt1 < team2) mx = max(mx, cnt1); } else { cnt2++; cnt1 = 0; team2++; if (team2 > team1 && team2 - cnt2 < team1) mx = max(mx, cnt2); } tie += team1 == team2; } cout << team1 << ' ' << team2 << '\n' << tie << '\n' << mx; }

Compilation message (stderr)

preokret.cpp:15:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   15 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...