Submission #1029664

#TimeUsernameProblemLanguageResultExecution timeMemory
1029664jnjwnwnwGlobal Warming (NOI13_gw)C++17
23 / 40
318 ms26520 KiB
#include <iostream> #include <algorithm> #include <vector> using namespace std; #define ll long long #define fff(i, a, b) for(ll i = a; i < b; i++) #define MAXN 1000006 bool sim[MAXN]; int main(){ ll n; cin >> n; vector<pair<ll, ll>> v; fff(i, 0, n){ ll a; cin >> a; v.emplace_back(a, i+1); } sort(v.rbegin(), v.rend()); // fff(i, 0, n){ // cout << v[i].first << " " << v[i].second << endl; // } cout << endl; ll best = 0; ll cur = 0; fff(i, 0, n){ auto [h, j] = v[i]; sim[j] = 1; cur++; if (sim[j+1]) cur--; if (sim[j-1]) cur--; if (cur > best) best = cur; } cout << best << endl; }
#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...