Submission #1045461

# Submission time Handle Problem Language Result Execution time Memory
1045461 2024-08-06T01:49:39 Z vjudge1 Rectangles (IOI19_rect) C++17
27 / 100
5000 ms 131412 KB
#include "rect.h"
#include<bits/stdc++.h>
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]));
                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 5 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 23416 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 23384 KB Output is correct
11 Correct 3 ms 23388 KB Output is correct
12 Correct 3 ms 23388 KB Output is correct
13 Correct 3 ms 23388 KB Output is correct
14 Correct 3 ms 23416 KB Output is correct
15 Correct 3 ms 23388 KB Output is correct
16 Correct 3 ms 23388 KB Output is correct
17 Correct 3 ms 23388 KB Output is correct
18 Correct 4 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 5 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 23416 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 23384 KB Output is correct
11 Correct 3 ms 23388 KB Output is correct
12 Correct 3 ms 23388 KB Output is correct
13 Correct 3 ms 23388 KB Output is correct
14 Correct 3 ms 23416 KB Output is correct
15 Correct 3 ms 23388 KB Output is correct
16 Correct 3 ms 23388 KB Output is correct
17 Correct 3 ms 23388 KB Output is correct
18 Correct 4 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 23864 KB Output is correct
24 Correct 11 ms 23856 KB Output is correct
25 Correct 6 ms 23644 KB Output is correct
26 Correct 6 ms 23644 KB Output is correct
27 Correct 8 ms 23672 KB Output is correct
28 Correct 7 ms 23824 KB Output is correct
29 Correct 5 ms 23644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 23388 KB Output is correct
2 Correct 5 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 23416 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 23384 KB Output is correct
11 Correct 3 ms 23388 KB Output is correct
12 Correct 3 ms 23388 KB Output is correct
13 Correct 3 ms 23388 KB Output is correct
14 Correct 3 ms 23416 KB Output is correct
15 Correct 3 ms 23388 KB Output is correct
16 Correct 3 ms 23388 KB Output is correct
17 Correct 10 ms 23644 KB Output is correct
18 Correct 10 ms 23864 KB Output is correct
19 Correct 11 ms 23856 KB Output is correct
20 Correct 6 ms 23644 KB Output is correct
21 Correct 6 ms 23644 KB Output is correct
22 Correct 8 ms 23672 KB Output is correct
23 Correct 7 ms 23824 KB Output is correct
24 Correct 5 ms 23644 KB Output is correct
25 Correct 3 ms 23388 KB Output is correct
26 Correct 4 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 128 ms 25692 KB Output is correct
31 Correct 119 ms 25692 KB Output is correct
32 Correct 117 ms 25944 KB Output is correct
33 Correct 41 ms 24412 KB Output is correct
34 Correct 47 ms 25688 KB Output is correct
35 Correct 48 ms 25948 KB Output is correct
36 Correct 50 ms 25692 KB Output is correct
37 Correct 48 ms 25688 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 23388 KB Output is correct
2 Correct 5 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 23416 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 23384 KB Output is correct
11 Correct 3 ms 23388 KB Output is correct
12 Correct 3 ms 23388 KB Output is correct
13 Correct 3 ms 23388 KB Output is correct
14 Correct 3 ms 23416 KB Output is correct
15 Correct 3 ms 23388 KB Output is correct
16 Correct 3 ms 23388 KB Output is correct
17 Correct 10 ms 23644 KB Output is correct
18 Correct 10 ms 23864 KB Output is correct
19 Correct 11 ms 23856 KB Output is correct
20 Correct 6 ms 23644 KB Output is correct
21 Correct 6 ms 23644 KB Output is correct
22 Correct 8 ms 23672 KB Output is correct
23 Correct 7 ms 23824 KB Output is correct
24 Correct 5 ms 23644 KB Output is correct
25 Correct 128 ms 25692 KB Output is correct
26 Correct 119 ms 25692 KB Output is correct
27 Correct 117 ms 25944 KB Output is correct
28 Correct 41 ms 24412 KB Output is correct
29 Correct 47 ms 25688 KB Output is correct
30 Correct 48 ms 25948 KB Output is correct
31 Correct 50 ms 25692 KB Output is correct
32 Correct 48 ms 25688 KB Output is correct
33 Correct 3 ms 23388 KB Output is correct
34 Correct 4 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 1602 ms 42064 KB Output is correct
39 Correct 1681 ms 42068 KB Output is correct
40 Correct 1599 ms 41828 KB Output is correct
41 Correct 1608 ms 41996 KB Output is correct
42 Execution timed out 5025 ms 53592 KB Time limit exceeded
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 23900 KB Output is correct
2 Correct 3 ms 23644 KB Output is correct
3 Correct 3 ms 23644 KB Output is correct
4 Runtime error 16 ms 47196 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 4 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 132 ms 131412 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 5 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 23416 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 23384 KB Output is correct
11 Correct 3 ms 23388 KB Output is correct
12 Correct 3 ms 23388 KB Output is correct
13 Correct 3 ms 23388 KB Output is correct
14 Correct 3 ms 23416 KB Output is correct
15 Correct 3 ms 23388 KB Output is correct
16 Correct 3 ms 23388 KB Output is correct
17 Correct 10 ms 23644 KB Output is correct
18 Correct 10 ms 23864 KB Output is correct
19 Correct 11 ms 23856 KB Output is correct
20 Correct 6 ms 23644 KB Output is correct
21 Correct 6 ms 23644 KB Output is correct
22 Correct 8 ms 23672 KB Output is correct
23 Correct 7 ms 23824 KB Output is correct
24 Correct 5 ms 23644 KB Output is correct
25 Correct 128 ms 25692 KB Output is correct
26 Correct 119 ms 25692 KB Output is correct
27 Correct 117 ms 25944 KB Output is correct
28 Correct 41 ms 24412 KB Output is correct
29 Correct 47 ms 25688 KB Output is correct
30 Correct 48 ms 25948 KB Output is correct
31 Correct 50 ms 25692 KB Output is correct
32 Correct 48 ms 25688 KB Output is correct
33 Correct 1602 ms 42064 KB Output is correct
34 Correct 1681 ms 42068 KB Output is correct
35 Correct 1599 ms 41828 KB Output is correct
36 Correct 1608 ms 41996 KB Output is correct
37 Execution timed out 5025 ms 53592 KB Time limit exceeded
38 Halted 0 ms 0 KB -