답안 #592622

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592622 2022-07-09T11:14:11 Z nguyen31hoang08minh2003 Preokret (COCI19_preokret) C++14
50 / 50
1 ms 212 KB
/*
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|////|   /|\   |\/\/|\/\/|   /|\   |\/ /|\ \/|   /|\   |\\\\|////|   /|\   |\/\/|\/\/|   /|\   |\/ /|\ \/|   /|\   |\\\\|////|   /|\   |
|/// |  /\|/\  | \/\|/\/ |  //|\\  | \/ | \/ |  /\|/\  | \\\|/// |  /\|/\  | \/\|/\/ |  //|\\  | \/ | \/ |  /\|/\  | \\\|/// |  /\|/\  |
|//  | /\ | /\ |  \/|\/  | ///|\\\ |  \/|\/  | /\/|\/\ |  \\|//  | /\ | /\ |  \/|\/  | ///|\\\ |  \/|\/  | /\/|\/\ |  \\|//  | /\ | /\ |
|/   |/\ \|/ /\|   \|/   |////|\\\\|   \|/   |/\/\|/\/\|   \|/   |/\ \|/ /\|   \|/   |////|\\\\|   \|/   |/\/\|/\/\|   \|/   |/\ \|/ /\|
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|\   |\/ /|\ \/|   /|\   |\\\\|////|   /|\   |\/\/|\/\/|   /|\           \/|   /|\   |\\\\|////|   /|\   |\/\/|\/\/|   /|\   |\/ /|\ \/|
|\\  | \/ | \/ |  /\|/\  | \\\|/// |  /\|/\  | \/\|/\/ |  //|\\  S J 9 2 / |  /\|/\  | \\\|/// |  /\|/\  | \/\|/\/ |  //|\\  | \/ | \/ |
|\\\ |  \/|\/  | /\/|\/\ |  \\|//  | /\ | /\ |  \/|\/  | ///|\\\ a u t 0   | /\/|\/\ |  \\|//  | /\ | /\ |  \/|\/  | ///|\\\ |  \/|\/  |
|\\\\|   \|/   |/\/\|/\/\|   \|/   |/\ \|/ /\|   \|/   |////|\\\ t l h 2   |/\/\|/\/\|   \|/   |/\ \|/ /\|   \|/   |////|\\\\|   \|/   |
+----+----+----+----+----+----+----+----+----+----+----+----+--- u y   2 --+----+----+----+----+----+----+----+----+----+----+----+----+
|////|   /|\   |\/\/|\/\/|   /|\   |\/ /|\ \/|   /|\   |\\\\|/// r   /     |\/\/|\/\/|   /|\   |\/ /|\ \/|   /|\   |\\\\|////|   /|\   |
|/// |  /\|/\  | \/\|/\/ |  //|\\  | \/ | \/ |  /\|/\  | \\\|/// d  /\|/\  | \/\|/\/ |  //|\\  | \/ | \/ |  /\|/\  | \\\|/// |  /\|/\  |
|//  | /\ | /\ |  \/|\/  | ///|\\\ |  \/|\/  | /\/|\/\ |  \\|//  a /\ | /\ |  \/|\/  | ///|\\\ |  \/|\/  | /\/|\/\ |  \\|//  | /\ | /\ |
|/   |/\ \|/ /\|   \|/   |////|\\\\|   \|/   |/\/\|/\/\|   \|/   y \ \|/ /\|   \|/   |////|\\\\|   \|/   |/\/\|/\/\|   \|/   |/\ \|/ /\|
+----+----+----+----+----+----+----+----+----+----+----+----+---   ---+----+----+----+----+----+----+----+----+----+----+----+----+----+
|\   |\/ /|\ \/|   /|\   |\\\\|////|   /|\   |\/\/|\/\/|   /|\   |\/ /|\ \/|   /|\   |\\\\|////|   /|\   |\/\/|\/\/|   /|\   |\/ /|\ \/|
|\\  | \/ | \/ |  /\|/\  | \\\|/// |  /\|/\  | \/\|/\/ |  //|\\  | \/ | \/ |  /\|/\  | \\\|/// |  /\|/\  | \/\|/\/ |  //|\\  | \/ | \/ |
|\\\ |  \/|\/  | /\/|\/\ |  \\|//  | /\ | /\ |  \/|\/  | ///|\\\ |  \/|\/  | /\/|\/\ |  \\|//  | /\ | /\ |  \/|\/  | ///|\\\ |  \/|\/  |
|\\\\|   \|/   |/\/\|/\/\|   \|/   |/\ \|/ /\|   \|/   |////|\\\\|   \|/   |/\/\|/\/\|   \|/   |/\ \|/ /\|   \|/   |////|\\\\|   \|/   |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
*/
#include <bits/stdc++.h>
#define fore(i, a, b) for (int i = (a), i##_last = (b); i < i##_last; ++i)
#define fort(i, a, b) for (int i = (a), i##_last = (b); i <= i##_last; ++i)
#define ford(i, a, b) for (int i = (a), i##_last = (b); i >= i##_last; --i)
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
using ld = long double;

template<class A, class B> bool maxi(A &a, const B &b) {return (a < b) ? (a = b, true):false;};
template<class A, class B> bool mini(A &a, const B &b) {return (a > b) ? (a = b, true):false;};

typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;

const int maxN = 255;

int n, p, d, drawCount = 1, maximum, goals[maxN], goalCount[2];
vi t;

int main() {
    #ifdef LOCAL
        freopen("input.INP", "r", stdin);
    #endif // LOCAL
    cin.tie(0) -> sync_with_stdio(0);
    cout.tie(0);
    cin >> n;
    goals[0] = -1;
    fort(i, 1, n) {
        cin >> goals[i];
        ++goalCount[--goals[i]];
        if (goals[i - 1] == goals[i])
            ++t.back();
        else
            t.pb(1);
        if (goalCount[0] == goalCount[1])
            ++drawCount;
    }
    cout << goalCount[0] << ' ' << goalCount[1] << '\n' << drawCount << '\n';
    fore(i, 0, sz(t)) {
        p = d;
        if (i & 1)
            d += t[i];
        else
            d -= t[i];
        if (d * p < 0)
            maxi(maximum, t[i]);
    }
    cout << maximum << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct