Created
October 9, 2019 03:35
-
-
Save surinoel/3c7fee18c372ce65a8f08dd65ffa7372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
int main(void) { | |
ios_base::sync_with_stdio(false); | |
cin.tie(nullptr); | |
int n; | |
cin >> n; | |
vector<pair<int, int>> v(n); | |
for (int i = 0; i < n; i++) { | |
cin >> v[i].first; | |
v[i].second = i; | |
} | |
sort(v.begin(), v.end()); | |
int ans = -1; | |
for (int i = 0; i < n; i++) { | |
ans = max(ans, v[i].second - i); | |
} | |
cout << ans + 1 << '\n'; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment