Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Created September 16, 2017 15:03
Show Gist options
  • Save invatainfo/5884f85bfa9610a2cf538c0f6cc7351a to your computer and use it in GitHub Desktop.
Save invatainfo/5884f85bfa9610a2cf538c0f6cc7351a to your computer and use it in GitHub Desktop.
#include <fstream.h>
fstream f("date.in", ios::in);
fstream g("date.out", ios::out);
void main() {
int i, j, n;
long a[100][100];
long max = 1000000000;
f >> n;
for (i = 1; i <= n; i++)
for (j = 1; j <= n; j++)
f >> a[i][j];
for (i = 0; i <= n + 1; i++)
a[0][i] = a[i][0] = a[i][n + 1] = a[n + 1][i] = max;
for (i = 1; i <= n; i++)
for (j = 1; j <= n; j++)
if (a[i][j] < a[i - 1][j] && a[i][j] < a[i][j - 1] &&
a[i][j] < a[i + 1][j] && a[i][j] < a[i][j + 1])
g << a[i][j] << " ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment