#include <iostream>
#include <vector>
using namespace std;
enum Player { ONE, TWO };
Player getWinner() {
int nMoves;
cin >> nMoves;
uint64_t score1 = 0, score2 = 0;
vector<int64_t> points1;
vector<int64_t> points2;
Player lastMoved = Player::ONE;
for (int i = 0; i < nMoves; i++) {
int64_t points;
cin >> points;
if (points > 0) {
points1.push_back(points);
score1 += points;
lastMoved = Player::ONE;
} else {
points2.push_back(-points);
score2 += -points;
lastMoved = Player::TWO;
}
if (score1 > score2) {
score1 -= score2;
score2 -= score2;
} else {
score2 -= score1;
score1 -= score1;
}
}
if (score1 > score2) {
return Player::ONE;
}
if (score1 < score2) {
return Player::TWO;
}
size_t i = 0;
while (i < points1.size() && i < points2.size()) {
if (points1[i] > points2[i]) {
return Player::ONE;
}
if (points1[i] < points2[i]) {
return Player::TWO;
}
i++;
}
if (points1.size() > points2.size()) {
return Player::ONE;
}
if (points1.size() < points2.size()) {
return Player::TWO;
}
return lastMoved;
}
int main() {
if (getWinner() == Player::ONE) {
cout << "first";
} else {
cout << "second";
}
return 0;
}
732B - Cormen --- The Best Friend Of a Man | 1369A - FashionabLee |
1474B - Different Divisors | 1632B - Roof Construction |
388A - Fox and Box Accumulation | 451A - Game With Sticks |
768A - Oath of the Night's Watch | 156C - Cipher |
545D - Queue | 459B - Pashmak and Flowers |
1538A - Stone Game | 1454C - Sequence Transformation |
165B - Burning Midnight Oil | 17A - Noldbach problem |
1350A - Orac and Factors | 1373A - Donut Shops |
26A - Almost Prime | 1656E - Equal Tree Sums |
1656B - Subtract Operation | 1656A - Good Pairs |
1367A - Short Substrings | 87A - Trains |
664A - Complicated GCD | 1635D - Infinite Set |
1462A - Favorite Sequence | 1445B - Elimination |
1656C - Make Equal With Mod | 567A - Lineland Mail |
1553A - Digits Sum | 1359B - New Theatre Square |