Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- int a[n+1];
- for(int i=1;i<=n;++i)
- cin>>a[i];
- int k=1;
- cout<<k<<' ';
- for(int i=2;i<=n;++i)
- if(a[i-1]+1==a[i])
- cout<<k<<' ';
- else
- ++k,cout<<k<<' ';
- cout<<'\n';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement