Submission #891445

# Submission time Handle Problem Language Result Execution time Memory
891445 2023-12-23T04:27:02 Z Sir_Ahmed_Imran Rectangles (IOI19_rect) C++17
0 / 100
5000 ms 79368 KB
                              ///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long 
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define N 2500
int l[N][N];
int u[N][N];
int r[N][N];
int d[N][N];
ll count_rectangles(vector<vector<int>> a){
    int n,m;
    n=a.size();
    m=a[0].size();
    for(int i=1;i<n-1;i++){
        for(int j=1;j<m-1;j++){
            l[i][j]=l[i-1][j]+(a[i][j]<a[i][j-1]);
            u[i][j]=u[i][j-1]+(a[i][j]<a[i-1][j]);
            r[i][j]=r[i-1][j]+(a[i][j]<a[i][j+1]);
            d[i][j]=d[i][j-1]+(a[i][j]<a[i+1][j]);
        }
    }
    ll o=0;
    for(int i1=1;i1<n-1;i1++){
        for(int j1=1;j1<m-1;j1++){
            for(int i2=i1;i2<n-1;i2++){
                for(int j2=j1;j2<m-1;j2++){
                    if(l[i2][j1]-l[i1-1][j1]==i2-i1+1
                    && u[i1][j2]-u[i1][j1-1]==j2-j1+1
                    && r[i2][j2]-r[i1-1][j2]==i2-i1+1
                    && d[i2][j2]-d[i2][j1-1]==j2-j1+1){
                        o++;
                    }
                }
            }
        }
    }
    return o;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 0 ms 396 KB Output is correct
5 Incorrect 4 ms 628 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Execution timed out 5044 ms 79368 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -