답안 #296735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
296735 2020-09-10T20:39:45 Z Dremix10 Rectangles (IOI19_rect) C++17
37 / 100
5000 ms 28408 KB
#include "rect.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#ifdef dremix
    #define p(x) cerr<<#x<<" = "<<x<<endl;
    #define p2(x,y) cerr<<#x<<" , "<<#y<<" = "<<x<<" , "<<y<<endl;
    #define pp(x) cerr<<#x<<" = ("<<x.F<<" , "<<x.S<<")"<<endl;
    #define pv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u<<", ";cerr<<"}"<<endl;
    #define ppv(x) cerr<<#x<<" = {";for(auto u : x)cerr<<u.F<<"-"<<u.S<<", ";cerr<<"}"<<endl;
#else
    #define p(x)
    #define p2(x,y)
    #define pp(x)
    #define pv(x)
    #define ppv(x)
#endif
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int maxp = 22;
const ld EPS = 1e-18;
const ll INF = 1e18;
const int MOD = 1e9+7;
const int N = 2e5+1;

long long count_rectangles(vector<vector<int> > a) {
    int n = a.size();
    int m = a[0].size();

    int i,j,ii,jj;

    ll ans = 0;

    for(i=1;i<n-1;i++)
        for(j=1;j<m-1;j++){
            int cols[m]={};
            bool rows[m];
            for(ii=j;ii<m-1;ii++)rows[ii] = true;

            for(ii=i;ii<n-1;ii++){
                bool flagCol = true;
                int maxi = 0;
                for(jj=j;jj<m-1;jj++){
                    if(i==4 && j==2){
                        pv(rows)
                        pv(cols)
                        p2(flagCol,maxi)
                    }
                    /// check validity
                    cols[jj] = max(cols[jj],a[ii][jj]);
                    if(cols[jj]>=a[i-1][jj] || cols[jj]>=a[ii+1][jj])
                        flagCol = false;
                    maxi = max(maxi,a[ii][jj]);
                    if(maxi>=a[ii][j-1] || maxi>=a[ii][jj+1])
                        rows[jj] = false;
                    if(flagCol && rows[jj]){
                        ans++;
                        ///p2(i,j)
                        ///p2(ii,jj)
                    }
                }

            }

        }

    return ans;
    /// g++ grader.cpp rect.cpp -Ddremix
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 1 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 1 ms 256 KB Output is correct
20 Correct 0 ms 256 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 26 ms 384 KB Output is correct
18 Correct 28 ms 384 KB Output is correct
19 Correct 27 ms 384 KB Output is correct
20 Correct 26 ms 384 KB Output is correct
21 Correct 30 ms 384 KB Output is correct
22 Correct 30 ms 384 KB Output is correct
23 Correct 29 ms 384 KB Output is correct
24 Correct 8 ms 384 KB Output is correct
25 Correct 1 ms 256 KB Output is correct
26 Correct 0 ms 256 KB Output is correct
27 Correct 1 ms 256 KB Output is correct
28 Correct 0 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 26 ms 384 KB Output is correct
18 Correct 28 ms 384 KB Output is correct
19 Correct 27 ms 384 KB Output is correct
20 Correct 26 ms 384 KB Output is correct
21 Correct 30 ms 384 KB Output is correct
22 Correct 30 ms 384 KB Output is correct
23 Correct 29 ms 384 KB Output is correct
24 Correct 8 ms 384 KB Output is correct
25 Correct 982 ms 912 KB Output is correct
26 Correct 1010 ms 908 KB Output is correct
27 Correct 1020 ms 984 KB Output is correct
28 Correct 793 ms 768 KB Output is correct
29 Correct 979 ms 804 KB Output is correct
30 Correct 954 ms 1016 KB Output is correct
31 Correct 923 ms 960 KB Output is correct
32 Correct 848 ms 896 KB Output is correct
33 Correct 1 ms 256 KB Output is correct
34 Correct 0 ms 256 KB Output is correct
35 Correct 1 ms 256 KB Output is correct
36 Correct 0 ms 256 KB Output is correct
37 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 26 ms 384 KB Output is correct
18 Correct 28 ms 384 KB Output is correct
19 Correct 27 ms 384 KB Output is correct
20 Correct 26 ms 384 KB Output is correct
21 Correct 30 ms 384 KB Output is correct
22 Correct 30 ms 384 KB Output is correct
23 Correct 29 ms 384 KB Output is correct
24 Correct 8 ms 384 KB Output is correct
25 Correct 982 ms 912 KB Output is correct
26 Correct 1010 ms 908 KB Output is correct
27 Correct 1020 ms 984 KB Output is correct
28 Correct 793 ms 768 KB Output is correct
29 Correct 979 ms 804 KB Output is correct
30 Correct 954 ms 1016 KB Output is correct
31 Correct 923 ms 960 KB Output is correct
32 Correct 848 ms 896 KB Output is correct
33 Execution timed out 5043 ms 7296 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 384 KB Output is correct
2 Correct 10 ms 384 KB Output is correct
3 Correct 11 ms 384 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 24 ms 384 KB Output is correct
6 Correct 17 ms 384 KB Output is correct
7 Correct 17 ms 384 KB Output is correct
8 Correct 16 ms 384 KB Output is correct
9 Correct 15 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Execution timed out 5013 ms 28408 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 1 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 26 ms 384 KB Output is correct
18 Correct 28 ms 384 KB Output is correct
19 Correct 27 ms 384 KB Output is correct
20 Correct 26 ms 384 KB Output is correct
21 Correct 30 ms 384 KB Output is correct
22 Correct 30 ms 384 KB Output is correct
23 Correct 29 ms 384 KB Output is correct
24 Correct 8 ms 384 KB Output is correct
25 Correct 982 ms 912 KB Output is correct
26 Correct 1010 ms 908 KB Output is correct
27 Correct 1020 ms 984 KB Output is correct
28 Correct 793 ms 768 KB Output is correct
29 Correct 979 ms 804 KB Output is correct
30 Correct 954 ms 1016 KB Output is correct
31 Correct 923 ms 960 KB Output is correct
32 Correct 848 ms 896 KB Output is correct
33 Execution timed out 5043 ms 7296 KB Time limit exceeded
34 Halted 0 ms 0 KB -