Please read the new rule regarding the restriction on the use of AI tools. ×

Dias_best's blog

By Dias_best, history, 2 hours ago, In Russian

include <bits/stdc++.h>

using namespace std; using ll=long long; int main() { int n,q; cin>>n>>q; pair<int,int>a[n+1]; for(int i=1;i<=n;i++) { cin>>a[i].first; a[i].second=i; } sort(a+1,a+1+n); while(q--) { int t; cin>>t; if(t==1) cout<<a[1].second; else cout<<a[n].second; cout<<'\n'; } }

  • Vote: I like it
  • 0
  • Vote: I do not like it