forked from kothariji/competitive-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path025.Vasya and Wrestling.cpp
65 lines (61 loc) · 1.12 KB
/
025.Vasya and Wrestling.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <bits/stdc++.h>
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
set<ll> usinversal;
ll ans = 0;
ll aa = 0;
int main()
{
fast;
ll n;
cin >> n;
ll sum1 = 0, sum2= 0;
vector<ll> a1, a2;
bool l;
while (n--)
{
ll x;
cin >>x;
if (x >= 0)
{
sum1 += x;
a1.push_back(x);
l = true;
}
else
{
sum2 += -1 *x;
a2.push_back(-1 * x);
l = false;
}
}
if (sum1 >sum2)
{
cout << "first" << "\n";
}
else if (sum2 > sum1)
{
cout << "second" << "\n";
}
else
{
if (a1 > a2)
{
cout << "first" << "\n";
}
else if (a1 < a2)
{
cout <<"second" << "\n";
}
else if (l)
{
cout << "first" << "\n";
}
else
{
cout << "second" << "\n";
}
}
return 0;
}