Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- int br=1;
- vector<pair<int, int>>v;
- for(int i=0; i<n; i++){
- int a;
- cin>>a;
- v.push_back(make_pair(a,i));
- }
- sort(v.begin(), v.end());
- for(int i=0; i<n; i++){
- if(v[i].second>v[i+1].second){
- br+=1;
- }
- }
- cout<<br;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement