我的sort在偷懒
查看原帖
我的sort在偷懒
1353273
OvOhappy楼主2024/10/13 11:14

求助

#include<bits/stdc++.h>
using namespace std;
int a[1005];
int main(){
	int n,q,x,y;
	cin >> n;
	for(int i = 1;i <= n;i ++){
		cin >> a[i];
	}
	cin >> q;
	for(int i = 1;i <= q;i ++){
		cin >> x >> y;
		sort(a+x,a+y);
	}
	for(int i = 1;i <= n;i ++){
		cout << a[i] << ' ';
	}
}
2024/10/13 11:14
加载中...