# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
199057 | smjleo | Preokret (COCI19_preokret) | C++14 | 6 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma region cp-helper
#include <bits/stdc++.h>
using namespace std;
#define AC ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define ull unsigned long long
#define ii pair<int, int>
#define lll pair<ll, ll>
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define vll vector<lll>
#define vvl vector<vl>
#define vii vector<ii>
#define all(a) a.begin(), a.end()
#define qsort(a) sort(all(a))
#define qsortd(a) sort(all(a), greater<>())
#define qsortf(a, f) sort(all(a), f)
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define pp(a, b) emplace_back(a, b)
#define umap unordered_map
#define uset unordered_set
#define nl '\n'
#define fileio(in, out) freopen(in, "r", stdin); freopen(out, "w", stdout)
#define qmod %mod
#define pls int
#define give main()
const int mod = 1000000007;
#pragma endregion
const int N = 300005;
int n, a, totala, totalb, ties=1, large, thres;
vii v;
pls give {
AC;
cin >> n;
while (n--) {
cin >> a;
if (a == 1) totala++;
else totalb++;
if (totala == totalb) ties++;
if (v.empty() or v.back().first != a) v.push_back({a, 1});
else v.back().second++;
}
totala = totalb = 0;
for (int i=0; i<v.size(); i++) {
thres = (v[i].first == 1 ? totalb - totala : totala - totalb);
if (thres>0 and thres<v[i].second) {
large = max(large, v[i].second);
}
(v[i].first == 1 ? totala : totalb) += v[i].second;
}
cout << totala << ' ' << totalb << nl;
cout << ties << nl;
cout << large << nl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |