Advertisement
erfanul007

Light OJ 10141

Jan 7th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long int ll;
  5. typedef unsigned long long int ull;
  6. typedef vector<int> vi;
  7. typedef vector<vi> vvi;
  8. typedef pair<int,int> pii;
  9. typedef vector< pii > vpii;
  10. typedef set<int> sti;
  11.  
  12. #define pb push_back
  13. #define mp make_pair
  14. #define ff first
  15. #define ss second
  16. #define loop1(i,n) for(int i=1; i<=int(n); i++)
  17. #define loop(i,y) for(int i=0; i<int(y); i++)
  18. #define read() freopen("input.txt", "r", stdin)
  19. #define write() freopen("output.txt", "w", stdout)
  20. #define cspf(i) printf("Case %d: ", i)
  21. #define cspft(i) printf("RFP #%d\n", i)
  22. /// Constants
  23. #define eps 1e-9
  24. #define PI acos(-1.0) // 3.1415926535897932
  25.  
  26. int main()
  27. {
  28. int n,p,i,j,k=0;
  29. while(1){
  30. scanf("%d %d",&n,&p);
  31. if(n==0 && p==0)
  32. break;
  33. if(k)
  34. printf("\n");
  35. char x[100],y[100],z[100];
  36. loop(i,n){
  37. getchar();
  38. scanf("%[^\n]",x);
  39. }
  40. int num=0;
  41. double vl;
  42. loop(j,p){
  43. int m,k;
  44. double v;
  45. getchar();
  46. scanf("%[^\n]",y);
  47. scanf("%lf %d",&v,&m);
  48. loop(k,m){
  49. getchar();
  50. scanf("%[^\n]",x);
  51. }
  52. if(m>num){
  53. num=m;
  54. vl=v;
  55. strcpy(z,y);
  56. }
  57. else if(m==num && v<vl){
  58. num=m;
  59. vl=v;
  60. strcpy(z,y);
  61. }
  62. }
  63. k++;
  64. cspft(k);
  65. printf("%s\n",z);
  66. }
  67. return 0;
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement