Submission #261276

# Submission time Handle Problem Language Result Execution time Memory
261276 2020-08-11T15:45:07 Z MohammadHijaz Rectangles (IOI19_rect) C++14
0 / 100
1 ms 512 KB
#include "rect.h"
using namespace std;
#include <bits/stdc++.h>

int n;
int m; 
int dx[] = {0 , 0 , 1 , -1};
int dy[] = {1 , -1 , 0 , 0};
vector<vector<int>> v;
int calc(int i , int j) {
	if (i == 0 || i == n - 1 || j == 0 || j == m - 1) {
		return 0;
	}
	for (int x = 0; x < 4; x++) {
		int new_x = dx[x];
		int new_y = dy[x];
		if (new_x <= 0 || new_x >= n - 1 || new_y <= 0 || new_y >= m -1) return 0;
		if (v[i][j] >= v[new_x][new_y]) {
			return 0;
		}
	}
	return 1;

}
long long count_rectangles(std::vector<std::vector<int>>a) {
	n = a.size();
	m = a[0].size();
	v = a;
	int ans = 0;
	for (int i = 1; i <= n - 1; i++) {
		for (int j = 1; j <= m - 1; j++) {
			ans += calc(i , j);
		}
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 512 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 368 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -