-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathB. Vasya and Wrestling - Codeforces Round 281 (Div. 2).cpp
58 lines (52 loc) · 1.39 KB
/
B. Vasya and Wrestling - Codeforces Round 281 (Div. 2).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
stdsetvbuf(stdout, nullptr, _IOFBF, BUFSIZ); (will neglect the c's stdio.h property of doing inline flushing with every line of code)
stdios_basesync_with_stdio(false); (removes the interoperability that happens between C's stdio.h and iostream )
#include iostream
#includenumeric
#includevector
#includecmath
#includestack
#include iomanip
#include vector
#includebitsstdc++.h
#include bitset
#includeiomanip
#include algorithm
#includequeue
#includedeque
#includenumeric
#includeset
#includeunordered_set
#includemap
#includefstream
#includesstream
#include thread
#include chrono
#includestring
#include unordered_map
int main(){
int n;
stdcinn;
stdvectorintfirst;
stdvectorintsecond;
int temp;
long long firstSum =0;
while(n--){
stdcintemp;
if (temp0){
first.push_back(temp);
firstSum+=temp;
}
else {
second.push_back(-1temp);
firstSum+=temp;
}
}
if (firstSum0 ) stdcoutfirst;
else if(firstSum0) stdcoutsecond;
else if (first.size()second.size() && firstsecond ) stdcoutfirst;
else if (first.size()second.size() && secondfirst)stdcoutsecond;
else if (!(firstsecond)&&!(firstsecond)) (temp0)stdcoutfirststdcoutsecond;
else if (firstsecond) stdcoutfirst;
else stdcoutsecond;
return 0;
}