solution1(通过60%)
cpp
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn = 100010;
int a[maxn];
bool cmp(int a, int b){
return a > b;
}
int main(){
int n, m, p, q;
scanf("%d%d", &n, &m);
for(int i = 1; i <= n; i++){
a[i] = i;
}
while(m--){
scanf("%d%d", &p, &q);
if(p) sort(a + q, a + n + 1);
else sort(a + 1, a + q + 1, cmp);
}
for(int i = 1; i <= n; i++){
printf("%d ", a[i]);
}
return 0;
}
solution2
未完待续 ╯︿╰