(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #811145

#제출 시각아이디문제언어결과실행 시간메모리
811145PringGrudanje (COCI19_grudanje)C++14
0 / 70
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define int long long typedef pair<int, int> pii; const int MXN = 255; int n, a[MXN]; pii sc[MXN]; int TIE() { int ans = 0; for (int i = 0; i <= n; i++) if (sc[i].first == sc[i].second) ans++; return ans; } int TURN() { int ans = 0; for (int i = 0, j = 0; i < n; i = j) { while (j < n && a[i] == a[j]) j++; if (a[i] == 1) { if (sc[i].first < sc[i].second && sc[j].first > sc[j].second) ans = max(ans, j - i); } else { if (sc[i].first > sc[i].second && sc[j].first < sc[j].second) ans = max(ans, j - i); } } return ans; } int32_t main() { cin.tie(0) -> sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; sc[i + 1] = sc[i]; if (a[i] == 1) sc[i + 1].first++; else sc[i + 1].second++; } cout << sc[n].first << ' ' << sc[n].second << endl; cout << TIE() << endl; cout << TURN() << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...