#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct node
{
double x,y;
}a[106];
bool cmp(node b,node c)
{
return b.x<c.x;
}
//LL a,b;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%lf%lf",&a[i].x,&a[i].y);
}
sort(a,a+n,cmp);
double red,blue;
red=blue=0;
for(int i=0;i<n;i++)
{
if(i%2==0)
red+=a[i].y;
else blue+=a[i].y;
}
if(red>blue)
printf("red\n");
else if(red<blue)
printf("blue\n");
else printf("fair\n");
}
return 0;
}
“浪潮杯”山东省第六届ACM大学生程序设计竞赛Nias and Tug-of-War
最新推荐文章于 2019-03-13 09:24:33 发布