codeforces@281 B

shui

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=220000;
int numa[maxn],numb[maxn];
long long suma,sumb;
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        int etc;
        int la=0,lb=0,last;
        suma=0;sumb=0;
        for(int i=0;i<n;i++){
            scanf("%d",&etc);
            if(etc>=0)
                {
                    numa[la++]=etc;
                    suma+=etc;
                }
            else{
                numb[lb++]=-etc;
                sumb+=-etc;
                }
            if(i==n-1){
                if(etc>=0) last=0;
                else last=1;
            }
        }
        int state=-1;
        for(int i=0;state==-1&&i<la&&i<lb;i++){
            if(numa[i]>numb[i])
                state=0;
            if(numa[i]<numb[i])
                state=1;
            }
        if(state==-1){
            if(la>lb) state=0;
            if(la<lb) state=1;
        }
        if(suma>sumb) printf("first\n");
        else if(suma<sumb) printf("second\n");
        else{
            if(state==0) printf("first\n");
            else if(state==1) printf("second\n");
            else{
                if(last==0) printf("first\n");
                else printf("second\n");
            }
        }
    }
    return 0;
}

 

posted @ 2014-12-04 14:48  JarvisLau  阅读(130)  评论(0编辑  收藏  举报