#include<stdio.h>
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<deque>
#include<vector>
#include<ctype.h>
using namespace std;
#define inf 999999
#define MAX 100
#define gcd(a,b) __gcd(a,b)
#define i64 long long
int getInt(){int x;scanf("%d",&x);return x;}
long long getLongLong(){long long x;scanf("%lld",&x);return x;}
double getDouble(){double x;scanf("%lf",&x);return x;}
char getChar(){char x;scanf("%c",&x);return x;}
#define Int getInt()
#define Char getChar()
#define I64 getLongLong()
#define Double getDouble()
struct contestant{
int penalty[10]={0},times=0;
bool solved[10]={0},touched=0;
int total=0;
int id;
};
bool comp(contestant a,contestant b)
{
if(a.total==b.total)
{
if(a.times==b.times)
{
return a.touched>b.touched;
}
return a.times<b.times;
}
return a.total>b.total;
}
int main()
{
int cases,caseno=0;
cases= Int;
char s[10000];
gets(s);
gets(s);
while(cases--)
{
contestant con[101];
if(caseno++)
printf("\n");
while(gets(s))
{
if(s[0]==NULL)
break;
int id,prbid,t;
char v;
sscanf(s,"%d %d %d %c",&id,&prbid,&t,&v);
con[id].touched=1;
con[id].id=id;
if(v=='C')
{
if(!con[id].solved[prbid])
{
con[id].solved[prbid]=1;
con[id].times+=t+con[id].penalty[prbid];
con[id].total++;
con[id].id=id;
}
}
else if(v=='I')
{
if(!con[id].solved[prbid])
{
con[id].penalty[prbid]+=20;
con[id].id=id;
}
}
}
sort(con+0,con+101,comp);
for(int i=0;i<101;i++)
{
if(!con[i].touched)
break;
printf( "%d %d %d\n",con[i].id,con[i].total,con[i].times);
}
}
return 0;
}
#include<iostream>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<deque>
#include<vector>
#include<ctype.h>
using namespace std;
#define inf 999999
#define MAX 100
#define gcd(a,b) __gcd(a,b)
#define i64 long long
int getInt(){int x;scanf("%d",&x);return x;}
long long getLongLong(){long long x;scanf("%lld",&x);return x;}
double getDouble(){double x;scanf("%lf",&x);return x;}
char getChar(){char x;scanf("%c",&x);return x;}
#define Int getInt()
#define Char getChar()
#define I64 getLongLong()
#define Double getDouble()
struct contestant{
int penalty[10]={0},times=0;
bool solved[10]={0},touched=0;
int total=0;
int id;
};
bool comp(contestant a,contestant b)
{
if(a.total==b.total)
{
if(a.times==b.times)
{
return a.touched>b.touched;
}
return a.times<b.times;
}
return a.total>b.total;
}
int main()
{
int cases,caseno=0;
cases= Int;
char s[10000];
gets(s);
gets(s);
while(cases--)
{
contestant con[101];
if(caseno++)
printf("\n");
while(gets(s))
{
if(s[0]==NULL)
break;
int id,prbid,t;
char v;
sscanf(s,"%d %d %d %c",&id,&prbid,&t,&v);
con[id].touched=1;
con[id].id=id;
if(v=='C')
{
if(!con[id].solved[prbid])
{
con[id].solved[prbid]=1;
con[id].times+=t+con[id].penalty[prbid];
con[id].total++;
con[id].id=id;
}
}
else if(v=='I')
{
if(!con[id].solved[prbid])
{
con[id].penalty[prbid]+=20;
con[id].id=id;
}
}
}
sort(con+0,con+101,comp);
for(int i=0;i<101;i++)
{
if(!con[i].touched)
break;
printf( "%d %d %d\n",con[i].id,con[i].total,con[i].times);
}
}
return 0;
}
No comments:
Post a Comment