# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
197824 | 2020-01-23T14:02:13 Z | Ruxandra985 | Maxcomp (info1cup18_maxcomp) | C++14 | 2 ms | 376 KB |
#include <cstdio> #include <iostream> using namespace std; int n , m , a[1010][1010] , d[1010]; int solve (){ int sol , i , j; sol = -1; for (j=0;j<=m;j++) d[j] = 2000000000; for (i=1;i<=n;i++){ for (j=1;j<=m;j++){ d[j] = min( min(d[j-1] , d[j]) , a[i][j] - i - j ); sol = max (sol , a[i][j] - d[j] - i - j - 1); } } return sol; } int main() { FILE *fin = stdin; FILE *fout = stdout; int i , j , sol , st , dr; fscanf (fin,"%d%d",&n,&m); for (i=1;i<=n;i++){ for (j=1;j<=m;j++){ fscanf (fin,"%d",&a[i][j]); } } sol = solve(); for (i=1;i<=n;i++){ st = 1; dr = m; while (st < dr){ swap(a[i][st] , a[i][dr]); st++; dr--; } } sol = max (sol , solve()); for (i=1;i<=m;i++){ st = 1; dr = n; while (st < dr){ swap(a[i][st] , a[i][dr]); st++; dr--; } } sol = max (sol , solve()); for (i=1;i<=n;i++){ st = 1; dr = m; while (st < dr){ swap(a[i][st] , a[i][dr]); st++; dr--; } } sol = max (sol , solve()); fprintf (fout,"%d",sol); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |