Submission #524011

#TimeUsernameProblemLanguageResultExecution timeMemory
524011maks007Maxcomp (info1cup18_maxcomp)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; #define inf -1e9 int main(void) { int n, m; cin >> n >> m; vector <vector <int> > g(n, vector <int> (m)); for(int i = 0; i < n; i ++) { for(int j = 0; j < m; j ++) cin >> g[i][j]; } vector <vector <int> > lu, ru, ld, rd; rd.resize(n, vector <int> (m, inf)); lu.resize(n, vector <int> (m, inf)); ru.resize(n, vector <int> (m, inf)); ld.resize(n, vector <int> (m, inf)); for(int i = 0; i < n; i ++) { for(int j = 0; j < m; j ++) { rd[i][j] = g[i][j] + i + j; if(i) rd[i][j] = min(rd[i][j], rd[i-1][j]); if(j) rd[i][j] = min(rd[i][j], rd[i][j-1]); } } int ans = -1e9; for(int i = 0; i < n; i ++) { for(int j = 0; j < m; j ++) { ans = max(ans, g[i][j] - rd[i][j] - (i+j)); } } cout << ans-1; return false; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...