답안 #592621

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592621 2022-07-09T11:08:17 Z nguyen31hoang08minh2003 Preokret (COCI19_preokret) C++14
40 / 50
1 ms 324 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;
    }
    fort(i, 0, 1)
        cout << goalCount[i] << ' ';
    cout << '\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 Partially correct 1 ms 324 KB Output is partially correct
2 Partially correct 0 ms 212 KB Output is partially correct
3 Partially correct 0 ms 212 KB Output is partially correct
4 Partially correct 0 ms 212 KB Output is partially correct
5 Partially correct 0 ms 212 KB Output is partially correct
6 Partially correct 1 ms 320 KB Output is partially correct
7 Partially correct 1 ms 212 KB Output is partially correct
8 Partially correct 1 ms 212 KB Output is partially correct
9 Partially correct 0 ms 212 KB Output is partially correct
10 Partially correct 1 ms 212 KB Output is partially correct