# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
423898 |
2021-06-11T13:59:45 Z |
schse |
Rectangles (IOI19_rect) |
C++17 |
|
5000 ms |
28356 KB |
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
#ifndef EVAL
#include "grader.cpp"
#endif
bool check(int r1, int r2, int c1, int c2, std::vector<std::vector<int>> &a)
{
for (int e = c1 + 1; e < c2; e++)
{
for (int i = r1 + 1; i < r2; i++)
{
if (a[i][e] >= a[r1][e] || a[i][e] >= a[r2][e])
return false;
if (a[i][e] >= a[i][c1] || a[i][e] >= a[i][c2])
return false;
}
}
return true;
}
long long count_rectangles(std::vector<std::vector<int>> a)
{
long long count = 0;
for (int r1 = 0; r1 < a.size(); r1++)
{
for (int c1 = 0; c1 < a[0].size(); c1++)
{
for (int r2 = r1 + 2; r2 < a.size(); r2++)
{
for (int c2 = c1 + 2; c2 < a[0].size(); c2++)
{
if (check(r1, r2, c1, c2, a))
count++;
}
}
}
}
return count;
}
Compilation message
rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for (int r1 = 0; r1 < a.size(); r1++)
| ~~~^~~~~~~~~~
rect.cpp:28:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
28 | for (int c1 = 0; c1 < a[0].size(); c1++)
| ~~~^~~~~~~~~~~~~
rect.cpp:30:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for (int r2 = r1 + 2; r2 < a.size(); r2++)
| ~~~^~~~~~~~~~
rect.cpp:32:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
32 | for (int c2 = c1 + 2; c2 < a[0].size(); c2++)
| ~~~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
2 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
2 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
2 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
0 ms |
204 KB |
Output is correct |
19 |
Correct |
2 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
83 ms |
356 KB |
Output is correct |
23 |
Correct |
83 ms |
376 KB |
Output is correct |
24 |
Correct |
88 ms |
356 KB |
Output is correct |
25 |
Correct |
75 ms |
452 KB |
Output is correct |
26 |
Correct |
77 ms |
344 KB |
Output is correct |
27 |
Correct |
81 ms |
332 KB |
Output is correct |
28 |
Correct |
84 ms |
356 KB |
Output is correct |
29 |
Correct |
19 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
2 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
83 ms |
356 KB |
Output is correct |
18 |
Correct |
83 ms |
376 KB |
Output is correct |
19 |
Correct |
88 ms |
356 KB |
Output is correct |
20 |
Correct |
75 ms |
452 KB |
Output is correct |
21 |
Correct |
77 ms |
344 KB |
Output is correct |
22 |
Correct |
81 ms |
332 KB |
Output is correct |
23 |
Correct |
84 ms |
356 KB |
Output is correct |
24 |
Correct |
19 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
204 KB |
Output is correct |
26 |
Correct |
0 ms |
204 KB |
Output is correct |
27 |
Correct |
2 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
204 KB |
Output is correct |
29 |
Correct |
1 ms |
204 KB |
Output is correct |
30 |
Correct |
3619 ms |
820 KB |
Output is correct |
31 |
Correct |
3618 ms |
836 KB |
Output is correct |
32 |
Correct |
3779 ms |
904 KB |
Output is correct |
33 |
Correct |
2935 ms |
668 KB |
Output is correct |
34 |
Correct |
3312 ms |
736 KB |
Output is correct |
35 |
Correct |
3479 ms |
904 KB |
Output is correct |
36 |
Correct |
3318 ms |
864 KB |
Output is correct |
37 |
Correct |
3175 ms |
888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
2 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
83 ms |
356 KB |
Output is correct |
18 |
Correct |
83 ms |
376 KB |
Output is correct |
19 |
Correct |
88 ms |
356 KB |
Output is correct |
20 |
Correct |
75 ms |
452 KB |
Output is correct |
21 |
Correct |
77 ms |
344 KB |
Output is correct |
22 |
Correct |
81 ms |
332 KB |
Output is correct |
23 |
Correct |
84 ms |
356 KB |
Output is correct |
24 |
Correct |
19 ms |
348 KB |
Output is correct |
25 |
Correct |
3619 ms |
820 KB |
Output is correct |
26 |
Correct |
3618 ms |
836 KB |
Output is correct |
27 |
Correct |
3779 ms |
904 KB |
Output is correct |
28 |
Correct |
2935 ms |
668 KB |
Output is correct |
29 |
Correct |
3312 ms |
736 KB |
Output is correct |
30 |
Correct |
3479 ms |
904 KB |
Output is correct |
31 |
Correct |
3318 ms |
864 KB |
Output is correct |
32 |
Correct |
3175 ms |
888 KB |
Output is correct |
33 |
Correct |
0 ms |
204 KB |
Output is correct |
34 |
Correct |
0 ms |
204 KB |
Output is correct |
35 |
Correct |
2 ms |
204 KB |
Output is correct |
36 |
Correct |
1 ms |
204 KB |
Output is correct |
37 |
Correct |
1 ms |
204 KB |
Output is correct |
38 |
Execution timed out |
5029 ms |
7212 KB |
Time limit exceeded |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
456 KB |
Output is correct |
2 |
Correct |
26 ms |
396 KB |
Output is correct |
3 |
Correct |
22 ms |
368 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
41 ms |
332 KB |
Output is correct |
6 |
Correct |
32 ms |
332 KB |
Output is correct |
7 |
Correct |
33 ms |
300 KB |
Output is correct |
8 |
Correct |
26 ms |
388 KB |
Output is correct |
9 |
Correct |
27 ms |
416 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Execution timed out |
5038 ms |
28356 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
2 ms |
204 KB |
Output is correct |
4 |
Correct |
2 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
204 KB |
Output is correct |
6 |
Correct |
2 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
2 ms |
204 KB |
Output is correct |
11 |
Correct |
2 ms |
204 KB |
Output is correct |
12 |
Correct |
2 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
83 ms |
356 KB |
Output is correct |
18 |
Correct |
83 ms |
376 KB |
Output is correct |
19 |
Correct |
88 ms |
356 KB |
Output is correct |
20 |
Correct |
75 ms |
452 KB |
Output is correct |
21 |
Correct |
77 ms |
344 KB |
Output is correct |
22 |
Correct |
81 ms |
332 KB |
Output is correct |
23 |
Correct |
84 ms |
356 KB |
Output is correct |
24 |
Correct |
19 ms |
348 KB |
Output is correct |
25 |
Correct |
3619 ms |
820 KB |
Output is correct |
26 |
Correct |
3618 ms |
836 KB |
Output is correct |
27 |
Correct |
3779 ms |
904 KB |
Output is correct |
28 |
Correct |
2935 ms |
668 KB |
Output is correct |
29 |
Correct |
3312 ms |
736 KB |
Output is correct |
30 |
Correct |
3479 ms |
904 KB |
Output is correct |
31 |
Correct |
3318 ms |
864 KB |
Output is correct |
32 |
Correct |
3175 ms |
888 KB |
Output is correct |
33 |
Execution timed out |
5029 ms |
7212 KB |
Time limit exceeded |
34 |
Halted |
0 ms |
0 KB |
- |