比赛 4043级2023省选练习赛2 评测结果 AAATAATATT
题目名称 排序 最终得分 60
用户昵称 遥时_彼方 运行时间 31.793 s
代码语言 C++ 内存使用 4.28 MiB
提交时间 2023-03-06 19:43:10
显示代码纯文本
  1. #include<bits/stdc++.h>
  2. #define rep(x,y,z) for(int x=y;x<=z;x++)
  3. #define drep(x,y,z) for(int x=y;x>=z;x--)
  4. #define ull unsigned long long
  5. #define ll long long
  6. using namespace std;
  7. inline int read()
  8. {
  9. int x=0;bool flag=1;char ch=getchar();
  10. while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
  11. while(ch>='0'&&ch<='9') {x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
  12. if(flag) return x;
  13. return ~(x-1);
  14. }
  15. inline void write(int x)
  16. {
  17. if(x<0) {x=~(x-1);putchar('-');}
  18. if(x>9) write(x/10);
  19. putchar(x%10+'0');
  20. }
  21. ////////////////////////
  22. int n,m;
  23. int a[100050];
  24. bool cmp(int x,int y){return x>y;}
  25. int main()
  26. {
  27. freopen("heoi2016_sort.in","r",stdin);
  28. freopen("heoi2016_sort.out","w",stdout);
  29. cin>>n>>m;
  30. rep(i,1,n) a[i]=read();
  31. int s1,s2,s3;
  32. rep(i,1,m)
  33. {
  34. s1=read(),s2=read(),s3=read();
  35. if(s1) sort(a+s2,a+s3+1,cmp);
  36. else sort(a+s2,a+s3+1);
  37. }
  38. s1=read();
  39. write(a[s1]),putchar(10);
  40. return 0;
  41. }
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.