Submission #147040

#TimeUsernameProblemLanguageResultExecution timeMemory
147040bortozGlobal Warming (NOI13_gw)C++17
40 / 40
289 ms18552 KiB
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define fi first #define se second constexpr int MAXN = 1e6 + 42; bool isl[MAXN]; int main() { ios::sync_with_stdio(false); int N; cin >> N; vector<pair<int, int>> V(N); for (int i = 0; i < N; i++) { cin >> V[i].fi; V[i].se = i + 1; } sort(V.rbegin(), V.rend()); int res = 0; int cur = 0; for (int i = 0; i < N; i++) { cur++; isl[V[i].se] = true; if (isl[V[i].se + 1]) { cur--; } if (isl[V[i].se - 1]) { cur--; } if (i == N - 1 || V[i].fi != V[i + 1].fi) { res = max(res, cur); } } cout << res << 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...