Submission #197488

# Submission time Handle Problem Language Result Execution time Memory
197488 2020-01-21T12:58:53 Z Minnakhmetov Rectangles (IOI19_rect) C++14
37 / 100
5000 ms 28380 KB
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long

bool check(vector<vector<int>> &a, int xl, int xr, int yl, int yr) {
	for (int i = xl; i <= xr; i++) {
		for (int j = yl; j <= yr; j++) {
			if (a[i][j] >= a[i][yl - 1] ||
				a[i][j] >= a[i][yr + 1] ||
				a[i][j] >= a[xl - 1][j] ||
				a[i][j] >= a[xr + 1][j]) {
				return false;
			}
		}
	}	
	return true;
}

ll count_rectangles(vector<vector<int>> a) {
	int n = a.size(),
		m = a[0].size();

	ll ans = 0;

	for (int xl = 1; xl < n - 1; xl++) {
		for (int yl = 1; yl < m - 1; yl++) {
			for (int xr = xl; xr < n - 1; xr++) {
				for (int yr = yl; yr < m - 1; yr++) {
					if (check(a, xl, xr, yl, yr))
						ans++;
				}
			}
		}
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 508 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 404 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 252 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 2 ms 436 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 3 ms 356 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 508 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 404 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 252 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 2 ms 436 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 128 ms 444 KB Output is correct
18 Correct 100 ms 460 KB Output is correct
19 Correct 99 ms 448 KB Output is correct
20 Correct 76 ms 420 KB Output is correct
21 Correct 81 ms 432 KB Output is correct
22 Correct 80 ms 452 KB Output is correct
23 Correct 82 ms 436 KB Output is correct
24 Correct 22 ms 380 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 4 ms 348 KB Output is correct
28 Correct 3 ms 356 KB Output is correct
29 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 508 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 404 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 252 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 2 ms 436 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 128 ms 444 KB Output is correct
18 Correct 100 ms 460 KB Output is correct
19 Correct 99 ms 448 KB Output is correct
20 Correct 76 ms 420 KB Output is correct
21 Correct 81 ms 432 KB Output is correct
22 Correct 80 ms 452 KB Output is correct
23 Correct 82 ms 436 KB Output is correct
24 Correct 22 ms 380 KB Output is correct
25 Correct 3874 ms 920 KB Output is correct
26 Correct 3861 ms 904 KB Output is correct
27 Correct 3891 ms 1000 KB Output is correct
28 Correct 2963 ms 724 KB Output is correct
29 Correct 3236 ms 828 KB Output is correct
30 Correct 3239 ms 1008 KB Output is correct
31 Correct 3191 ms 960 KB Output is correct
32 Correct 3114 ms 988 KB Output is correct
33 Correct 2 ms 256 KB Output is correct
34 Correct 2 ms 376 KB Output is correct
35 Correct 4 ms 348 KB Output is correct
36 Correct 3 ms 356 KB Output is correct
37 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 508 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 404 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 252 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 2 ms 436 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 128 ms 444 KB Output is correct
18 Correct 100 ms 460 KB Output is correct
19 Correct 99 ms 448 KB Output is correct
20 Correct 76 ms 420 KB Output is correct
21 Correct 81 ms 432 KB Output is correct
22 Correct 80 ms 452 KB Output is correct
23 Correct 82 ms 436 KB Output is correct
24 Correct 22 ms 380 KB Output is correct
25 Correct 3874 ms 920 KB Output is correct
26 Correct 3861 ms 904 KB Output is correct
27 Correct 3891 ms 1000 KB Output is correct
28 Correct 2963 ms 724 KB Output is correct
29 Correct 3236 ms 828 KB Output is correct
30 Correct 3239 ms 1008 KB Output is correct
31 Correct 3191 ms 960 KB Output is correct
32 Correct 3114 ms 988 KB Output is correct
33 Execution timed out 5024 ms 7288 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 376 KB Output is correct
2 Correct 25 ms 504 KB Output is correct
3 Correct 23 ms 448 KB Output is correct
4 Correct 2 ms 380 KB Output is correct
5 Correct 34 ms 376 KB Output is correct
6 Correct 33 ms 412 KB Output is correct
7 Correct 34 ms 504 KB Output is correct
8 Correct 33 ms 376 KB Output is correct
9 Correct 32 ms 504 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Execution timed out 5087 ms 28380 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 508 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 4 ms 404 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 252 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 2 ms 436 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 4 ms 348 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 4 ms 348 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 128 ms 444 KB Output is correct
18 Correct 100 ms 460 KB Output is correct
19 Correct 99 ms 448 KB Output is correct
20 Correct 76 ms 420 KB Output is correct
21 Correct 81 ms 432 KB Output is correct
22 Correct 80 ms 452 KB Output is correct
23 Correct 82 ms 436 KB Output is correct
24 Correct 22 ms 380 KB Output is correct
25 Correct 3874 ms 920 KB Output is correct
26 Correct 3861 ms 904 KB Output is correct
27 Correct 3891 ms 1000 KB Output is correct
28 Correct 2963 ms 724 KB Output is correct
29 Correct 3236 ms 828 KB Output is correct
30 Correct 3239 ms 1008 KB Output is correct
31 Correct 3191 ms 960 KB Output is correct
32 Correct 3114 ms 988 KB Output is correct
33 Execution timed out 5024 ms 7288 KB Time limit exceeded
34 Halted 0 ms 0 KB -