Submission #415329

# Submission time Handle Problem Language Result Execution time Memory
415329 2021-05-31T21:56:47 Z peuch Rectangles (IOI19_rect) C++17
49 / 100
4944 ms 142000 KB
#include "rect.h"
#include<bits/stdc++.h>
using namespace std;
 
const int MAXN = 710;
 
bitset<MAXN> lVal[MAXN][MAXN];
bitset<MAXN> cVal[MAXN][MAXN];
 
long long count_rectangles(std::vector<std::vector<int> > a) {
	int n = a.size();
	int m = a[0].size();
	
	for(int i = 1; i < n - 1; i++){
		for(int j = 1; j < m - 1; j++){
			int maxi = 0;
			for(int k = j; k < m - 1; k++){
				maxi = max(maxi, a[i][k]);
				lVal[i][j][k] = maxi < a[i][j - 1] && maxi < a[i][k + 1];
			}
		}
	}
	for(int i = 1; i < m - 1; i++){
		for(int j = 1; j < n - 1; j++){
			int maxi = 0;
			for(int k = j; k < n - 1; k++){
				maxi = max(maxi, a[k][i]);
				cVal[i][j][k] = maxi < a[j - 1][i] && maxi < a[k + 1][i];
			}
		}
	}
	
	long long ans = 0;
	
	for(int i = 1; i < n - 1; i++){
		for(int j = 1; j < m - 1; j++){
			bitset<MAXN> marc = lVal[i][j];
			for(int k = i; k < n - 1; k++){
				marc &= lVal[k][j];
				for(int l = j; l < m - 1; l++){
					if(cVal[l][i][k] == 0) break;
					ans += marc[l];
				}
			}
		}
	}
	
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 588 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 588 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 6 ms 2124 KB Output is correct
23 Correct 6 ms 2124 KB Output is correct
24 Correct 7 ms 2124 KB Output is correct
25 Correct 6 ms 2124 KB Output is correct
26 Correct 6 ms 1996 KB Output is correct
27 Correct 6 ms 1996 KB Output is correct
28 Correct 6 ms 2124 KB Output is correct
29 Correct 3 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 6 ms 2124 KB Output is correct
18 Correct 6 ms 2124 KB Output is correct
19 Correct 7 ms 2124 KB Output is correct
20 Correct 6 ms 2124 KB Output is correct
21 Correct 6 ms 1996 KB Output is correct
22 Correct 6 ms 1996 KB Output is correct
23 Correct 6 ms 2124 KB Output is correct
24 Correct 3 ms 1356 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 1 ms 588 KB Output is correct
28 Correct 1 ms 460 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 84 ms 9564 KB Output is correct
31 Correct 81 ms 9552 KB Output is correct
32 Correct 81 ms 9516 KB Output is correct
33 Correct 70 ms 9556 KB Output is correct
34 Correct 72 ms 9560 KB Output is correct
35 Correct 72 ms 9540 KB Output is correct
36 Correct 76 ms 9472 KB Output is correct
37 Correct 77 ms 9436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 6 ms 2124 KB Output is correct
18 Correct 6 ms 2124 KB Output is correct
19 Correct 7 ms 2124 KB Output is correct
20 Correct 6 ms 2124 KB Output is correct
21 Correct 6 ms 1996 KB Output is correct
22 Correct 6 ms 1996 KB Output is correct
23 Correct 6 ms 2124 KB Output is correct
24 Correct 3 ms 1356 KB Output is correct
25 Correct 84 ms 9564 KB Output is correct
26 Correct 81 ms 9552 KB Output is correct
27 Correct 81 ms 9516 KB Output is correct
28 Correct 70 ms 9556 KB Output is correct
29 Correct 72 ms 9560 KB Output is correct
30 Correct 72 ms 9540 KB Output is correct
31 Correct 76 ms 9472 KB Output is correct
32 Correct 77 ms 9436 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 588 KB Output is correct
36 Correct 1 ms 460 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
38 Correct 4630 ms 97292 KB Output is correct
39 Correct 4691 ms 97272 KB Output is correct
40 Correct 4033 ms 97264 KB Output is correct
41 Correct 4336 ms 97268 KB Output is correct
42 Correct 4540 ms 97328 KB Output is correct
43 Correct 4649 ms 97208 KB Output is correct
44 Correct 4753 ms 100824 KB Output is correct
45 Correct 4626 ms 96468 KB Output is correct
46 Correct 4178 ms 98244 KB Output is correct
47 Correct 4519 ms 98276 KB Output is correct
48 Correct 4489 ms 99136 KB Output is correct
49 Correct 3752 ms 100960 KB Output is correct
50 Correct 1886 ms 52904 KB Output is correct
51 Correct 1058 ms 52900 KB Output is correct
52 Correct 3958 ms 100040 KB Output is correct
53 Correct 4274 ms 100992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 41 ms 12844 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 588 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Runtime error 4944 ms 142000 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 588 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 1 ms 588 KB Output is correct
5 Correct 1 ms 588 KB Output is correct
6 Correct 1 ms 588 KB Output is correct
7 Correct 1 ms 460 KB Output is correct
8 Correct 1 ms 460 KB Output is correct
9 Correct 1 ms 588 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 1 ms 588 KB Output is correct
12 Correct 1 ms 588 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 6 ms 2124 KB Output is correct
18 Correct 6 ms 2124 KB Output is correct
19 Correct 7 ms 2124 KB Output is correct
20 Correct 6 ms 2124 KB Output is correct
21 Correct 6 ms 1996 KB Output is correct
22 Correct 6 ms 1996 KB Output is correct
23 Correct 6 ms 2124 KB Output is correct
24 Correct 3 ms 1356 KB Output is correct
25 Correct 84 ms 9564 KB Output is correct
26 Correct 81 ms 9552 KB Output is correct
27 Correct 81 ms 9516 KB Output is correct
28 Correct 70 ms 9556 KB Output is correct
29 Correct 72 ms 9560 KB Output is correct
30 Correct 72 ms 9540 KB Output is correct
31 Correct 76 ms 9472 KB Output is correct
32 Correct 77 ms 9436 KB Output is correct
33 Correct 4630 ms 97292 KB Output is correct
34 Correct 4691 ms 97272 KB Output is correct
35 Correct 4033 ms 97264 KB Output is correct
36 Correct 4336 ms 97268 KB Output is correct
37 Correct 4540 ms 97328 KB Output is correct
38 Correct 4649 ms 97208 KB Output is correct
39 Correct 4753 ms 100824 KB Output is correct
40 Correct 4626 ms 96468 KB Output is correct
41 Correct 4178 ms 98244 KB Output is correct
42 Correct 4519 ms 98276 KB Output is correct
43 Correct 4489 ms 99136 KB Output is correct
44 Correct 3752 ms 100960 KB Output is correct
45 Correct 1886 ms 52904 KB Output is correct
46 Correct 1058 ms 52900 KB Output is correct
47 Correct 3958 ms 100040 KB Output is correct
48 Correct 4274 ms 100992 KB Output is correct
49 Runtime error 41 ms 12844 KB Execution killed with signal 11
50 Halted 0 ms 0 KB -