-
Notifications
You must be signed in to change notification settings - Fork 0
/
spoj_army.cpp
107 lines (58 loc) · 1.28 KB
/
spoj_army.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define vll vector<ll>
#define vvll vector< vll >
#define pll pair<ll ,ll >
#define vpll vector< pll >
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define fst first
#define scd second
#define fr(i,n) for(ll (i) = 0 ; (i) < (n) ; ++(i))
#define fr1(i,n) for(ll (i) = 1 ; (i) <= (n) ; ++(i))
#define frr(i,n) for(ll (i) = (n)-1 ; (i)>=0 ; --(i))
#define forab(i,a,b,c) for(ll (i) = a ; (i) <= (b) ; (i)+=(c))
#define mst(A) memset( (A) , 0 , sizeof(A) );
using namespace std;
void read(ll &x){
scanf("%lld",&x);
}
void read(ll &x,ll &y){
scanf("%lld%lld",&x,&y);
}
void read(vll &oneD){
for(ll i=0;i<oneD.size();i++){
read(oneD[i]);
}
}
void write(vll &oneD){
for(ll i=0;i<oneD.size();i++){
printf("%lld ",oneD[i]);
}
printf("\n");
}
int main()
{
ll i,j,t,nm,ng,a,best,sum=0;
read(t);
while(t--)
{
best=0;sum=0;
read(ng);
vll v1(ng);
vll v2(ng);
read(v1);
read(v2);
for(i=0;i<ng;i++)
{
sum= max(v1[i]+sum,v1[i]);
best=max(sum,best);
}
cout<<best<<endl;
}
return 0;
}