wojiaocbj

Untitled

May 21st, 2022
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.29 KB | None | 0 0
  1. /*
  2.  Author: 曹北健(37509)
  3.  Result: AC Submission_id: 4471563
  4.  Created at: Fri May 20 2022 17:07:11 GMT+0800 (China Standard Time)
  5.  Problem: 5840  Time: 188   Memory: 200116
  6. */
  7.  
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10. #include <math.h>
  11. #include <string.h>
  12. #include <ctype.h>
  13. #pragma warning(disable:4996)
  14. typedef long long s64, LL;
  15. typedef unsigned long long u64, ULL;
  16. typedef const void *cvp;
  17. typedef struct data{
  18.     int age;
  19.     char name[1004];
  20. }data;
  21. data arr[200010], *parr[200010];
  22. int main(){
  23. #ifdef _DEBUG
  24.     FILE *fp = freopen("../../../input.txt", "r", stdin);
  25.     //FILE *fp2 = freopen("../../../output.txt", "w", stdout);
  26. #endif // _DEBUG
  27.     int n, m, k, i, j, l, r;
  28.     data *p;
  29.     scanf("%d%d%d", &n, &m, &k);
  30.     for(i = 1; i <= n; i++){
  31.         scanf("%d%s", &arr[i].age, arr[i].name);
  32.         parr[i] = arr + i;
  33.     }
  34.     for(i = 1; i <= m; i++){
  35.         scanf("%d%d", &l, &r);
  36.         while(l < r){
  37.             p = parr[l]; parr[l] = parr[r]; parr[r] = p;
  38.             l++; r--;
  39.         }
  40.     }
  41.     for(i = 1; i <= k; i++){
  42.         scanf("%d", &j);
  43.         printf("%d %s\n", parr[j]->age, parr[j]->name);
  44.     }
  45. #ifdef _DEBUG
  46.     fp = freopen("CON", "r", stdin);
  47.     //fp2 = freopen("CON", "w", stdout);
  48.     system("pause");
  49. #endif // _DEBUG
  50.     return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment