# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1035446 |
2024-07-26T11:13:59 Z |
Abito |
Rectangles (IOI19_rect) |
C++17 |
|
527 ms |
65684 KB |
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
const int N=205;
int n,m,a[N][N],pr[N][N][N],pc[N][N][N];
long long count_rectangles(vector<vector<int>> v){
n=v.size();
m=v[0].size();
if (n<=2 || m<=2) return 0LL;
for (int i=0;i<n;i++) for (int j=0;j<m;j++) a[i+1][j+1]=v[i][j];
for (int i=2;i<n;i++){
for (int j=2;j<m;j++){
int mx=a[i][j];
for (int k=j;k<m;k++){
mx=max(mx,a[i][k]);
pr[i][j][k]=pr[i-1][j][k]+bool(mx<a[i][j-1] && mx<a[i][k+1]);
//if (mx<a[i][j-1] && mx<a[i][k+1]) cout<<i<<' '<<j<<' '<<k<<endl;
}
}
}
for (int i=2;i<m;i++){
for (int j=2;j<n;j++){
int mx=a[j][i];
for (int k=j;k<n;k++){
mx=max(mx,a[k][i]);
pc[i][j][k]=pc[i-1][j][k]+bool(mx<a[j-1][i] && mx<a[k+1][i]);
//if (mx<a[j-1][i] && mx<a[k+1][i]) cout<<i<<' '<<j<<' '<<k<<endl;
}
}
}
long long ans=0;
for (int i=2;i<n;i++){
for (int j=2;j<m;j++){
for (int k=i;k<n;k++){
for (int l=j;l<m;l++){
ans+=bool(pr[k][j][l]-pr[i-1][j][l]==k-i+1 && pc[l][i][k]-pc[j-1][i][k]==l-j+1);
}
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
2 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
1 ms |
1884 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
0 ms |
860 KB |
Output is correct |
9 |
Correct |
1 ms |
1884 KB |
Output is correct |
10 |
Correct |
1 ms |
1884 KB |
Output is correct |
11 |
Correct |
1 ms |
1880 KB |
Output is correct |
12 |
Correct |
1 ms |
1884 KB |
Output is correct |
13 |
Correct |
0 ms |
436 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
604 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
1884 KB |
Output is correct |
20 |
Correct |
1 ms |
1116 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
2 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
1 ms |
1884 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
0 ms |
860 KB |
Output is correct |
9 |
Correct |
1 ms |
1884 KB |
Output is correct |
10 |
Correct |
1 ms |
1884 KB |
Output is correct |
11 |
Correct |
1 ms |
1880 KB |
Output is correct |
12 |
Correct |
1 ms |
1884 KB |
Output is correct |
13 |
Correct |
0 ms |
436 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
604 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
1884 KB |
Output is correct |
20 |
Correct |
1 ms |
1116 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
18 ms |
10748 KB |
Output is correct |
23 |
Correct |
17 ms |
10960 KB |
Output is correct |
24 |
Correct |
22 ms |
10844 KB |
Output is correct |
25 |
Correct |
18 ms |
10840 KB |
Output is correct |
26 |
Correct |
19 ms |
10584 KB |
Output is correct |
27 |
Correct |
18 ms |
10584 KB |
Output is correct |
28 |
Correct |
19 ms |
10928 KB |
Output is correct |
29 |
Correct |
6 ms |
5568 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
2 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
1 ms |
1884 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
0 ms |
860 KB |
Output is correct |
9 |
Correct |
1 ms |
1884 KB |
Output is correct |
10 |
Correct |
1 ms |
1884 KB |
Output is correct |
11 |
Correct |
1 ms |
1880 KB |
Output is correct |
12 |
Correct |
1 ms |
1884 KB |
Output is correct |
13 |
Correct |
0 ms |
436 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
604 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
18 ms |
10748 KB |
Output is correct |
18 |
Correct |
17 ms |
10960 KB |
Output is correct |
19 |
Correct |
22 ms |
10844 KB |
Output is correct |
20 |
Correct |
18 ms |
10840 KB |
Output is correct |
21 |
Correct |
19 ms |
10584 KB |
Output is correct |
22 |
Correct |
18 ms |
10584 KB |
Output is correct |
23 |
Correct |
19 ms |
10928 KB |
Output is correct |
24 |
Correct |
6 ms |
5568 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
1 ms |
1884 KB |
Output is correct |
28 |
Correct |
1 ms |
1116 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
505 ms |
65360 KB |
Output is correct |
31 |
Correct |
527 ms |
65368 KB |
Output is correct |
32 |
Correct |
487 ms |
65620 KB |
Output is correct |
33 |
Correct |
483 ms |
65372 KB |
Output is correct |
34 |
Correct |
444 ms |
65484 KB |
Output is correct |
35 |
Correct |
474 ms |
65684 KB |
Output is correct |
36 |
Correct |
479 ms |
65652 KB |
Output is correct |
37 |
Correct |
458 ms |
64592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
2 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
1 ms |
1884 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
0 ms |
860 KB |
Output is correct |
9 |
Correct |
1 ms |
1884 KB |
Output is correct |
10 |
Correct |
1 ms |
1884 KB |
Output is correct |
11 |
Correct |
1 ms |
1880 KB |
Output is correct |
12 |
Correct |
1 ms |
1884 KB |
Output is correct |
13 |
Correct |
0 ms |
436 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
604 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
18 ms |
10748 KB |
Output is correct |
18 |
Correct |
17 ms |
10960 KB |
Output is correct |
19 |
Correct |
22 ms |
10844 KB |
Output is correct |
20 |
Correct |
18 ms |
10840 KB |
Output is correct |
21 |
Correct |
19 ms |
10584 KB |
Output is correct |
22 |
Correct |
18 ms |
10584 KB |
Output is correct |
23 |
Correct |
19 ms |
10928 KB |
Output is correct |
24 |
Correct |
6 ms |
5568 KB |
Output is correct |
25 |
Correct |
505 ms |
65360 KB |
Output is correct |
26 |
Correct |
527 ms |
65368 KB |
Output is correct |
27 |
Correct |
487 ms |
65620 KB |
Output is correct |
28 |
Correct |
483 ms |
65372 KB |
Output is correct |
29 |
Correct |
444 ms |
65484 KB |
Output is correct |
30 |
Correct |
474 ms |
65684 KB |
Output is correct |
31 |
Correct |
479 ms |
65652 KB |
Output is correct |
32 |
Correct |
458 ms |
64592 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
1884 KB |
Output is correct |
36 |
Correct |
1 ms |
1116 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Runtime error |
17 ms |
11860 KB |
Execution killed with signal 11 |
39 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
10 ms |
8284 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1116 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Runtime error |
52 ms |
52048 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
1884 KB |
Output is correct |
3 |
Correct |
2 ms |
1884 KB |
Output is correct |
4 |
Correct |
1 ms |
1884 KB |
Output is correct |
5 |
Correct |
1 ms |
1884 KB |
Output is correct |
6 |
Correct |
1 ms |
1884 KB |
Output is correct |
7 |
Correct |
1 ms |
860 KB |
Output is correct |
8 |
Correct |
0 ms |
860 KB |
Output is correct |
9 |
Correct |
1 ms |
1884 KB |
Output is correct |
10 |
Correct |
1 ms |
1884 KB |
Output is correct |
11 |
Correct |
1 ms |
1880 KB |
Output is correct |
12 |
Correct |
1 ms |
1884 KB |
Output is correct |
13 |
Correct |
0 ms |
436 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
604 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
18 ms |
10748 KB |
Output is correct |
18 |
Correct |
17 ms |
10960 KB |
Output is correct |
19 |
Correct |
22 ms |
10844 KB |
Output is correct |
20 |
Correct |
18 ms |
10840 KB |
Output is correct |
21 |
Correct |
19 ms |
10584 KB |
Output is correct |
22 |
Correct |
18 ms |
10584 KB |
Output is correct |
23 |
Correct |
19 ms |
10928 KB |
Output is correct |
24 |
Correct |
6 ms |
5568 KB |
Output is correct |
25 |
Correct |
505 ms |
65360 KB |
Output is correct |
26 |
Correct |
527 ms |
65368 KB |
Output is correct |
27 |
Correct |
487 ms |
65620 KB |
Output is correct |
28 |
Correct |
483 ms |
65372 KB |
Output is correct |
29 |
Correct |
444 ms |
65484 KB |
Output is correct |
30 |
Correct |
474 ms |
65684 KB |
Output is correct |
31 |
Correct |
479 ms |
65652 KB |
Output is correct |
32 |
Correct |
458 ms |
64592 KB |
Output is correct |
33 |
Runtime error |
17 ms |
11860 KB |
Execution killed with signal 11 |
34 |
Halted |
0 ms |
0 KB |
- |