Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- typedef unsigned long long int ull;
- typedef vector<int> vi;
- typedef vector<vi> vvi;
- typedef pair<int,int> pii;
- typedef vector< pii > vpii;
- typedef set<int> sti;
- #define pb push_back
- #define mp make_pair
- #define ff first
- #define ss second
- #define loop1(i,n) for(int i=1; i<=int(n); i++)
- #define loop(i,y) for(int i=0; i<int(y); i++)
- #define read() freopen("input.txt", "r", stdin)
- #define write() freopen("output.txt", "w", stdout)
- #define cspf(i) printf("Case %d: ", i)
- #define cspft(i) printf("RFP #%d\n", i)
- /// Constants
- #define eps 1e-9
- #define PI acos(-1.0) // 3.1415926535897932
- int main()
- {
- int n,p,i,j,k=0;
- while(1){
- scanf("%d %d",&n,&p);
- if(n==0 && p==0)
- break;
- if(k)
- printf("\n");
- char x[100],y[100],z[100];
- loop(i,n){
- getchar();
- scanf("%[^\n]",x);
- }
- int num=0;
- double vl;
- loop(j,p){
- int m,k;
- double v;
- getchar();
- scanf("%[^\n]",y);
- scanf("%lf %d",&v,&m);
- loop(k,m){
- getchar();
- scanf("%[^\n]",x);
- }
- if(m>num){
- num=m;
- vl=v;
- strcpy(z,y);
- }
- else if(m==num && v<vl){
- num=m;
- vl=v;
- strcpy(z,y);
- }
- }
- k++;
- cspft(k);
- printf("%s\n",z);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement