Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <bits/stdc++.h>
- #define boAshraf { ios_base::sync_with_stdio(false); cin.tie(NULL); }
- #define ll long long
- #define sz(s) (int)(s).size()
- #define endl "\n"
- #define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update>
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/tree_policy.hpp>
- using namespace __gnu_pbds;
- using namespace std;
- void File();
- void sol();
- int main() {
- boAshraf
- File();
- int t = 1;
- cin >> t;
- while (t--) {
- sol();
- }
- return 0;
- }
- void sol() {
- int n,l,r;cin>>n>>l>>r;
- vector<int>v(n+1),pre(n+1);
- v[0]=-2e9;
- int mx=0;
- for (int i = 1; i <=n ; ++i) {
- cin>>v[i];
- if(v[i]<=v[i-1])pre[i]=pre[i-1]+1;
- else pre[i]=1;
- mx=max(mx,pre[i]);
- }
- int mn=n*2;
- for (int i = n; i >=1 ; --i) {
- if(pre[i]==mx)mn=min(mn,abs(r-i)+abs(l-(i-mx+1)));
- }
- cout<<mx<<' '<<mn<<endl;
- }
- void File() {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment