# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1045463 |
2024-08-06T01:52:04 Z |
vjudge1 |
Rectangles (IOI19_rect) |
C++17 |
|
4836 ms |
131272 KB |
#include "rect.h"
#include<bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
set<int>pos[701][701];
long long count_rectangles(std::vector<std::vector<int> > a) {
int n=a.size(),m=a[0].size();
int ans=0;
for(int i=1;i<n-1;i++){
stack<int>stk;
stk.push(m-1);
for(int j=m-1;j--;){
while(stk.size()&&a[i][j]>a[i][stk.top()])
pos[i][j+1].insert(stk.top()-1),stk.pop();
if(stk.size()){
pos[i][j+1].insert(stk.top()-1);
if(a[i][stk.top()]==a[i][j])
stk.pop();
}
stk.push(j);
pos[i][j+1].erase(j);
}
}
for(int r1=1;r1<n-1;r1++){
vector<set<int>>stuf(m);
vector<int>mx(m,0);
for(int i=1;i<m-1;i++)
stuf[i]=pos[r1][i];
for(int r2=r1;r2<n-1;r2++){
vector<int>sz(m);
for(int i=m-1;--i;){
set<int>st;
for(auto y:stuf[i])
if(pos[r2][i].count(y))
st.insert(y);
stuf[i]=st;
mx[i]=max(mx[i],a[r2][i]);
sz[i]=(1+sz[i+1])*(mx[i]<min(a[r1-1][i],a[r2+1][i]));
if(!sz[i]) continue;
ans+=distance(st.begin(),st.lower_bound(i+sz[i]));
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
23388 KB |
Output is correct |
2 |
Correct |
3 ms |
23388 KB |
Output is correct |
3 |
Correct |
3 ms |
23388 KB |
Output is correct |
4 |
Correct |
3 ms |
23388 KB |
Output is correct |
5 |
Correct |
3 ms |
23388 KB |
Output is correct |
6 |
Correct |
3 ms |
23384 KB |
Output is correct |
7 |
Correct |
3 ms |
23388 KB |
Output is correct |
8 |
Correct |
3 ms |
23388 KB |
Output is correct |
9 |
Correct |
3 ms |
23388 KB |
Output is correct |
10 |
Correct |
3 ms |
23388 KB |
Output is correct |
11 |
Correct |
3 ms |
23388 KB |
Output is correct |
12 |
Correct |
4 ms |
23388 KB |
Output is correct |
13 |
Correct |
3 ms |
23388 KB |
Output is correct |
14 |
Correct |
3 ms |
23388 KB |
Output is correct |
15 |
Correct |
3 ms |
23384 KB |
Output is correct |
16 |
Correct |
3 ms |
23384 KB |
Output is correct |
17 |
Correct |
3 ms |
23388 KB |
Output is correct |
18 |
Correct |
3 ms |
23384 KB |
Output is correct |
19 |
Correct |
3 ms |
23388 KB |
Output is correct |
20 |
Correct |
3 ms |
23388 KB |
Output is correct |
21 |
Correct |
3 ms |
23388 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
23388 KB |
Output is correct |
2 |
Correct |
3 ms |
23388 KB |
Output is correct |
3 |
Correct |
3 ms |
23388 KB |
Output is correct |
4 |
Correct |
3 ms |
23388 KB |
Output is correct |
5 |
Correct |
3 ms |
23388 KB |
Output is correct |
6 |
Correct |
3 ms |
23384 KB |
Output is correct |
7 |
Correct |
3 ms |
23388 KB |
Output is correct |
8 |
Correct |
3 ms |
23388 KB |
Output is correct |
9 |
Correct |
3 ms |
23388 KB |
Output is correct |
10 |
Correct |
3 ms |
23388 KB |
Output is correct |
11 |
Correct |
3 ms |
23388 KB |
Output is correct |
12 |
Correct |
4 ms |
23388 KB |
Output is correct |
13 |
Correct |
3 ms |
23388 KB |
Output is correct |
14 |
Correct |
3 ms |
23388 KB |
Output is correct |
15 |
Correct |
3 ms |
23384 KB |
Output is correct |
16 |
Correct |
3 ms |
23384 KB |
Output is correct |
17 |
Correct |
3 ms |
23388 KB |
Output is correct |
18 |
Correct |
3 ms |
23384 KB |
Output is correct |
19 |
Correct |
3 ms |
23388 KB |
Output is correct |
20 |
Correct |
3 ms |
23388 KB |
Output is correct |
21 |
Correct |
3 ms |
23388 KB |
Output is correct |
22 |
Correct |
10 ms |
23644 KB |
Output is correct |
23 |
Correct |
10 ms |
23868 KB |
Output is correct |
24 |
Correct |
10 ms |
23644 KB |
Output is correct |
25 |
Correct |
6 ms |
23644 KB |
Output is correct |
26 |
Correct |
7 ms |
23644 KB |
Output is correct |
27 |
Correct |
7 ms |
23640 KB |
Output is correct |
28 |
Correct |
8 ms |
23640 KB |
Output is correct |
29 |
Correct |
5 ms |
23524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
23388 KB |
Output is correct |
2 |
Correct |
3 ms |
23388 KB |
Output is correct |
3 |
Correct |
3 ms |
23388 KB |
Output is correct |
4 |
Correct |
3 ms |
23388 KB |
Output is correct |
5 |
Correct |
3 ms |
23388 KB |
Output is correct |
6 |
Correct |
3 ms |
23384 KB |
Output is correct |
7 |
Correct |
3 ms |
23388 KB |
Output is correct |
8 |
Correct |
3 ms |
23388 KB |
Output is correct |
9 |
Correct |
3 ms |
23388 KB |
Output is correct |
10 |
Correct |
3 ms |
23388 KB |
Output is correct |
11 |
Correct |
3 ms |
23388 KB |
Output is correct |
12 |
Correct |
4 ms |
23388 KB |
Output is correct |
13 |
Correct |
3 ms |
23388 KB |
Output is correct |
14 |
Correct |
3 ms |
23388 KB |
Output is correct |
15 |
Correct |
3 ms |
23384 KB |
Output is correct |
16 |
Correct |
3 ms |
23384 KB |
Output is correct |
17 |
Correct |
10 ms |
23644 KB |
Output is correct |
18 |
Correct |
10 ms |
23868 KB |
Output is correct |
19 |
Correct |
10 ms |
23644 KB |
Output is correct |
20 |
Correct |
6 ms |
23644 KB |
Output is correct |
21 |
Correct |
7 ms |
23644 KB |
Output is correct |
22 |
Correct |
7 ms |
23640 KB |
Output is correct |
23 |
Correct |
8 ms |
23640 KB |
Output is correct |
24 |
Correct |
5 ms |
23524 KB |
Output is correct |
25 |
Correct |
3 ms |
23388 KB |
Output is correct |
26 |
Correct |
3 ms |
23384 KB |
Output is correct |
27 |
Correct |
3 ms |
23388 KB |
Output is correct |
28 |
Correct |
3 ms |
23388 KB |
Output is correct |
29 |
Correct |
3 ms |
23388 KB |
Output is correct |
30 |
Correct |
113 ms |
25692 KB |
Output is correct |
31 |
Correct |
112 ms |
25692 KB |
Output is correct |
32 |
Correct |
112 ms |
25688 KB |
Output is correct |
33 |
Correct |
42 ms |
24552 KB |
Output is correct |
34 |
Correct |
49 ms |
25432 KB |
Output is correct |
35 |
Correct |
48 ms |
25592 KB |
Output is correct |
36 |
Correct |
60 ms |
25432 KB |
Output is correct |
37 |
Correct |
46 ms |
25436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
23388 KB |
Output is correct |
2 |
Correct |
3 ms |
23388 KB |
Output is correct |
3 |
Correct |
3 ms |
23388 KB |
Output is correct |
4 |
Correct |
3 ms |
23388 KB |
Output is correct |
5 |
Correct |
3 ms |
23388 KB |
Output is correct |
6 |
Correct |
3 ms |
23384 KB |
Output is correct |
7 |
Correct |
3 ms |
23388 KB |
Output is correct |
8 |
Correct |
3 ms |
23388 KB |
Output is correct |
9 |
Correct |
3 ms |
23388 KB |
Output is correct |
10 |
Correct |
3 ms |
23388 KB |
Output is correct |
11 |
Correct |
3 ms |
23388 KB |
Output is correct |
12 |
Correct |
4 ms |
23388 KB |
Output is correct |
13 |
Correct |
3 ms |
23388 KB |
Output is correct |
14 |
Correct |
3 ms |
23388 KB |
Output is correct |
15 |
Correct |
3 ms |
23384 KB |
Output is correct |
16 |
Correct |
3 ms |
23384 KB |
Output is correct |
17 |
Correct |
10 ms |
23644 KB |
Output is correct |
18 |
Correct |
10 ms |
23868 KB |
Output is correct |
19 |
Correct |
10 ms |
23644 KB |
Output is correct |
20 |
Correct |
6 ms |
23644 KB |
Output is correct |
21 |
Correct |
7 ms |
23644 KB |
Output is correct |
22 |
Correct |
7 ms |
23640 KB |
Output is correct |
23 |
Correct |
8 ms |
23640 KB |
Output is correct |
24 |
Correct |
5 ms |
23524 KB |
Output is correct |
25 |
Correct |
113 ms |
25692 KB |
Output is correct |
26 |
Correct |
112 ms |
25692 KB |
Output is correct |
27 |
Correct |
112 ms |
25688 KB |
Output is correct |
28 |
Correct |
42 ms |
24552 KB |
Output is correct |
29 |
Correct |
49 ms |
25432 KB |
Output is correct |
30 |
Correct |
48 ms |
25592 KB |
Output is correct |
31 |
Correct |
60 ms |
25432 KB |
Output is correct |
32 |
Correct |
46 ms |
25436 KB |
Output is correct |
33 |
Correct |
3 ms |
23388 KB |
Output is correct |
34 |
Correct |
3 ms |
23384 KB |
Output is correct |
35 |
Correct |
3 ms |
23388 KB |
Output is correct |
36 |
Correct |
3 ms |
23388 KB |
Output is correct |
37 |
Correct |
3 ms |
23388 KB |
Output is correct |
38 |
Correct |
1522 ms |
38880 KB |
Output is correct |
39 |
Correct |
1544 ms |
38736 KB |
Output is correct |
40 |
Correct |
1519 ms |
38920 KB |
Output is correct |
41 |
Correct |
1589 ms |
38944 KB |
Output is correct |
42 |
Correct |
4727 ms |
50332 KB |
Output is correct |
43 |
Correct |
4747 ms |
53540 KB |
Output is correct |
44 |
Correct |
4836 ms |
53892 KB |
Output is correct |
45 |
Correct |
4090 ms |
51880 KB |
Output is correct |
46 |
Correct |
1532 ms |
34108 KB |
Output is correct |
47 |
Correct |
1549 ms |
37456 KB |
Output is correct |
48 |
Correct |
1628 ms |
51284 KB |
Output is correct |
49 |
Correct |
1622 ms |
53588 KB |
Output is correct |
50 |
Correct |
842 ms |
38428 KB |
Output is correct |
51 |
Correct |
433 ms |
38484 KB |
Output is correct |
52 |
Correct |
1745 ms |
50768 KB |
Output is correct |
53 |
Correct |
1695 ms |
51844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
23900 KB |
Output is correct |
2 |
Correct |
4 ms |
23648 KB |
Output is correct |
3 |
Correct |
3 ms |
23644 KB |
Output is correct |
4 |
Runtime error |
16 ms |
47220 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
23388 KB |
Output is correct |
2 |
Correct |
3 ms |
23384 KB |
Output is correct |
3 |
Correct |
3 ms |
23388 KB |
Output is correct |
4 |
Correct |
3 ms |
23388 KB |
Output is correct |
5 |
Correct |
3 ms |
23388 KB |
Output is correct |
6 |
Correct |
3 ms |
23388 KB |
Output is correct |
7 |
Runtime error |
130 ms |
131272 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
23388 KB |
Output is correct |
2 |
Correct |
3 ms |
23388 KB |
Output is correct |
3 |
Correct |
3 ms |
23388 KB |
Output is correct |
4 |
Correct |
3 ms |
23388 KB |
Output is correct |
5 |
Correct |
3 ms |
23388 KB |
Output is correct |
6 |
Correct |
3 ms |
23384 KB |
Output is correct |
7 |
Correct |
3 ms |
23388 KB |
Output is correct |
8 |
Correct |
3 ms |
23388 KB |
Output is correct |
9 |
Correct |
3 ms |
23388 KB |
Output is correct |
10 |
Correct |
3 ms |
23388 KB |
Output is correct |
11 |
Correct |
3 ms |
23388 KB |
Output is correct |
12 |
Correct |
4 ms |
23388 KB |
Output is correct |
13 |
Correct |
3 ms |
23388 KB |
Output is correct |
14 |
Correct |
3 ms |
23388 KB |
Output is correct |
15 |
Correct |
3 ms |
23384 KB |
Output is correct |
16 |
Correct |
3 ms |
23384 KB |
Output is correct |
17 |
Correct |
10 ms |
23644 KB |
Output is correct |
18 |
Correct |
10 ms |
23868 KB |
Output is correct |
19 |
Correct |
10 ms |
23644 KB |
Output is correct |
20 |
Correct |
6 ms |
23644 KB |
Output is correct |
21 |
Correct |
7 ms |
23644 KB |
Output is correct |
22 |
Correct |
7 ms |
23640 KB |
Output is correct |
23 |
Correct |
8 ms |
23640 KB |
Output is correct |
24 |
Correct |
5 ms |
23524 KB |
Output is correct |
25 |
Correct |
113 ms |
25692 KB |
Output is correct |
26 |
Correct |
112 ms |
25692 KB |
Output is correct |
27 |
Correct |
112 ms |
25688 KB |
Output is correct |
28 |
Correct |
42 ms |
24552 KB |
Output is correct |
29 |
Correct |
49 ms |
25432 KB |
Output is correct |
30 |
Correct |
48 ms |
25592 KB |
Output is correct |
31 |
Correct |
60 ms |
25432 KB |
Output is correct |
32 |
Correct |
46 ms |
25436 KB |
Output is correct |
33 |
Correct |
1522 ms |
38880 KB |
Output is correct |
34 |
Correct |
1544 ms |
38736 KB |
Output is correct |
35 |
Correct |
1519 ms |
38920 KB |
Output is correct |
36 |
Correct |
1589 ms |
38944 KB |
Output is correct |
37 |
Correct |
4727 ms |
50332 KB |
Output is correct |
38 |
Correct |
4747 ms |
53540 KB |
Output is correct |
39 |
Correct |
4836 ms |
53892 KB |
Output is correct |
40 |
Correct |
4090 ms |
51880 KB |
Output is correct |
41 |
Correct |
1532 ms |
34108 KB |
Output is correct |
42 |
Correct |
1549 ms |
37456 KB |
Output is correct |
43 |
Correct |
1628 ms |
51284 KB |
Output is correct |
44 |
Correct |
1622 ms |
53588 KB |
Output is correct |
45 |
Correct |
842 ms |
38428 KB |
Output is correct |
46 |
Correct |
433 ms |
38484 KB |
Output is correct |
47 |
Correct |
1745 ms |
50768 KB |
Output is correct |
48 |
Correct |
1695 ms |
51844 KB |
Output is correct |
49 |
Correct |
4 ms |
23900 KB |
Output is correct |
50 |
Correct |
4 ms |
23648 KB |
Output is correct |
51 |
Correct |
3 ms |
23644 KB |
Output is correct |
52 |
Runtime error |
16 ms |
47220 KB |
Execution killed with signal 11 |
53 |
Halted |
0 ms |
0 KB |
- |