-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolve.cpp
More file actions
83 lines (68 loc) · 2.73 KB
/
Copy pathsolve.cpp
File metadata and controls
83 lines (68 loc) · 2.73 KB
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
#include <bits/stdc++.h>
using namespace std;
// ██████╗░██╗░██████╗███╗░░░███╗██╗██╗░░░░░██╗░░░░░░█████╗░██╗░░██╗
// ██╔══██╗██║██╔════╝████╗░████║██║██║░░░░░██║░░░░░██╔══██╗██║░░██║
// ██████╦╝██║╚█████╗░██╔████╔██║██║██║░░░░░██║░░░░░███████║███████║
// ██╔══██╗██║░╚═══██╗██║╚██╔╝██║██║██║░░░░░██║░░░░░██╔══██║██╔══██║
// ██████╦╝██║██████╔╝██║░╚═╝░██║██║███████╗███████╗██║░░██║██║░░██║
// ╚═════╝░╚═╝╚═════╝░╚═╝░░░░░╚═╝╚═╝╚══════╝╚══════╝╚═╝░░╚═╝╚═╝░░╚═╝
#define bismillah ios::sync_with_stdio(false); cin.tie(NULL);
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fr(i, n) for (ll i = 0; i < (n); i++)
#define frr(i,n) for (ll i = 1; i <= (n); i++)
#define pb push_back
#define fi first
#define se second
#define no cout << "NO" << endl;
#define yes cout << "YES" << endl;
#define maxx(a,b,c) max((a), max((b),(c))
#define minn(a,b,c) min((a), min((b),(c))
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
const ll INF = 1e18;
const int MOD = 1e9+7;
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " = " << x << endl;
#else
#define debug(x)
#endif
ll fpb(ll a, ll b){
if(b == 0) return a;
return fpb(b, a % b);
}
ll kpk(ll a, ll b){
return a / fpb(a,b) * b;
}
void solve(){
int r,c;cin>>r>>c;
vector<vi> tabel(r,vi(c));
for(auto &row : tabel) for (auto &x : row) cin>>x;
int best = INT_MIN;
for (int top = 0; top < r; top++){
vi temp(c,0);
for (int bot = top; bot < r; bot++){
for(int j = 0; j < c; j++) temp[j] += tabel[bot][j];
int mx=temp[0], cur=temp[0];
for (int j = 1; j < c; j++) {
cur=max(temp[j], cur+temp[j]);
mx=max(cur,mx);
}
best=max(best,mx);
}
}
cout << best;
}
int main(){
bismillah;
int t = 1;
// cin >> t;
while(t--){
solve();
}
}