2025-05-20 22:12:18 +09:00

21 lines
387 B
C

#include <stdio.h>
int main(){
int arr[100];
int m,n,x,i,j,t;
scanf("%d %d",&n, &m);
for(x=0; x<n; x++) arr[x] = x+1;
while(m--){
scanf("%d %d",&i,&j);
for(x=0;x<(j-i+1)/2;x++){
t = arr[i+x-1];
arr[i+x-1] = arr[j-x-1];
arr[j-x-1] = t;
}
}
for(x=0; x<n; x++) printf("%d ",arr[x]);
return 0;
}