Submission #592622

#TimeUsernameProblemLanguageResultExecution timeMemory
592622nguyen31hoang08minh2003Preokret (COCI19_preokret)C++14
50 / 50
1 ms212 KiB
/* +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ |////| /|\ |\/\/|\/\/| /|\ |\/ /|\ \/| /|\ |\\\\|////| /|\ |\/\/|\/\/| /|\ |\/ /|\ \/| /|\ |\\\\|////| /|\ | |/// | /\|/\ | \/\|/\/ | //|\\ | \/ | \/ | /\|/\ | \\\|/// | /\|/\ | \/\|/\/ | //|\\ | \/ | \/ | /\|/\ | \\\|/// | /\|/\ | |// | /\ | /\ | \/|\/ | ///|\\\ | \/|\/ | /\/|\/\ | \\|// | /\ | /\ | \/|\/ | ///|\\\ | \/|\/ | /\/|\/\ | \\|// | /\ | /\ | |/ |/\ \|/ /\| \|/ |////|\\\\| \|/ |/\/\|/\/\| \|/ |/\ \|/ /\| \|/ |////|\\\\| \|/ |/\/\|/\/\| \|/ |/\ \|/ /\| +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+ |\ |\/ /|\ \/| /|\ |\\\\|////| /|\ |\/\/|\/\/| /|\ \/| /|\ |\\\\|////| /|\ |\/\/|\/\/| /|\ |\/ /|\ \/| |\\ | \/ | \/ | /\|/\ | \\\|/// | /\|/\ | \/\|/\/ | //|\\ 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; }
#Verdict Execution timeMemoryGrader output
Fetching results...