답안 #423307

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
423307 2021-06-10T23:24:18 Z Monchito Rectangles (IOI19_rect) C++14
37 / 100
5000 ms 28228 KB
#include "rect.h"
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

int n, m;

bool can(int r1, int r2, int c1, int c2, vvi& a){
    for(int i=r1; i<=r2; i++){
        for(int  j=c1; j<=c2; j++){
            if(a[i][j] >= a[i][c1-1] || a[i][j] >= a[i][c2+1])
                return false;

            if(a[i][j] >= a[r1-1][j] || a[i][j] >= a[r2+1][j])
                return false;
        }
    }

    return true;
}

ll count_rectangles(vvi a) {
    ll ret = 0;
    n = a.size(); 
    m = a[0].size();

    for(int r1=1; r1<n-1; r1++){
        for(int r2=r1; r2<n-1; r2++){
            for(int c1=1; c1<m-1; c1++){
                for(int c2=c1; c2<m-1; c2++){
                    if(can(r1, r2, c1, c2, a)) ret++; 
                }
            }
        }
    }

	return ret;
}
# 결과 실행 시간 메모리 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 276 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 1 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 1 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 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 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 276 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 1 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 1 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 0 ms 204 KB Output is correct
22 Correct 86 ms 344 KB Output is correct
23 Correct 85 ms 332 KB Output is correct
24 Correct 86 ms 348 KB Output is correct
25 Correct 82 ms 332 KB Output is correct
26 Correct 90 ms 332 KB Output is correct
27 Correct 90 ms 332 KB Output is correct
28 Correct 93 ms 340 KB Output is correct
29 Correct 22 ms 204 KB Output is correct
# 결과 실행 시간 메모리 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 276 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 1 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 86 ms 344 KB Output is correct
18 Correct 85 ms 332 KB Output is correct
19 Correct 86 ms 348 KB Output is correct
20 Correct 82 ms 332 KB Output is correct
21 Correct 90 ms 332 KB Output is correct
22 Correct 90 ms 332 KB Output is correct
23 Correct 93 ms 340 KB Output is correct
24 Correct 22 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 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 0 ms 204 KB Output is correct
30 Correct 3306 ms 812 KB Output is correct
31 Correct 3326 ms 804 KB Output is correct
32 Correct 3331 ms 888 KB Output is correct
33 Correct 3329 ms 664 KB Output is correct
34 Correct 3651 ms 740 KB Output is correct
35 Correct 3705 ms 884 KB Output is correct
36 Correct 3566 ms 848 KB Output is correct
37 Correct 3465 ms 872 KB Output is correct
# 결과 실행 시간 메모리 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 276 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 1 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 86 ms 344 KB Output is correct
18 Correct 85 ms 332 KB Output is correct
19 Correct 86 ms 348 KB Output is correct
20 Correct 82 ms 332 KB Output is correct
21 Correct 90 ms 332 KB Output is correct
22 Correct 90 ms 332 KB Output is correct
23 Correct 93 ms 340 KB Output is correct
24 Correct 22 ms 204 KB Output is correct
25 Correct 3306 ms 812 KB Output is correct
26 Correct 3326 ms 804 KB Output is correct
27 Correct 3331 ms 888 KB Output is correct
28 Correct 3329 ms 664 KB Output is correct
29 Correct 3651 ms 740 KB Output is correct
30 Correct 3705 ms 884 KB Output is correct
31 Correct 3566 ms 848 KB Output is correct
32 Correct 3465 ms 872 KB Output is correct
33 Correct 0 ms 204 KB Output is correct
34 Correct 1 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 0 ms 204 KB Output is correct
38 Execution timed out 5070 ms 7192 KB Time limit exceeded
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 460 KB Output is correct
2 Correct 20 ms 332 KB Output is correct
3 Correct 22 ms 332 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 32 ms 400 KB Output is correct
6 Correct 30 ms 400 KB Output is correct
7 Correct 30 ms 392 KB Output is correct
8 Correct 30 ms 332 KB Output is correct
9 Correct 28 ms 332 KB Output is correct
10 Correct 1 ms 288 KB Output is correct
11 Correct 1 ms 284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Execution timed out 5033 ms 28228 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 276 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 1 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 86 ms 344 KB Output is correct
18 Correct 85 ms 332 KB Output is correct
19 Correct 86 ms 348 KB Output is correct
20 Correct 82 ms 332 KB Output is correct
21 Correct 90 ms 332 KB Output is correct
22 Correct 90 ms 332 KB Output is correct
23 Correct 93 ms 340 KB Output is correct
24 Correct 22 ms 204 KB Output is correct
25 Correct 3306 ms 812 KB Output is correct
26 Correct 3326 ms 804 KB Output is correct
27 Correct 3331 ms 888 KB Output is correct
28 Correct 3329 ms 664 KB Output is correct
29 Correct 3651 ms 740 KB Output is correct
30 Correct 3705 ms 884 KB Output is correct
31 Correct 3566 ms 848 KB Output is correct
32 Correct 3465 ms 872 KB Output is correct
33 Execution timed out 5070 ms 7192 KB Time limit exceeded
34 Halted 0 ms 0 KB -