Submission #826169

# Submission time Handle Problem Language Result Execution time Memory
826169 2023-08-15T10:52:48 Z Ahmed57 Quality Of Living (IOI10_quality) C++17
100 / 100
1092 ms 140160 KB
#include <bits/stdc++.h>
using namespace std;
int rectangle(int R, int C, int H, int W, int  Q[3001][3001]){
    int l = 1 , r = (R*C) ,ans = 0;
    while(l<=r){
        int mid = (l+r)/2;
        int pref[R+1][C+1];
        memset(pref,0,sizeof pref);
        for(int i = 0;i<R;i++){
            for(int j = 0;j<C;j++){
                pref[i+1][j+1] = (Q[i][j]<=mid)+pref[i][j+1]+pref[i+1][j]-pref[i][j];
            }
        }
        bool ss = 0;
        for(int i = H;i<=R;i++){
            for(int j = W;j<=C;j++){
                if(pref[i][j]-pref[i-H][j]-pref[i][j-W]+pref[i-H][j-W]>=(H*W+1)/2){
                    ss = 1;
                }
            }
        }
        if(ss){
            ans = mid;
            r = mid-1;
        }else l = mid+1;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 2 ms 724 KB Output is correct
6 Correct 1 ms 824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 2 ms 724 KB Output is correct
6 Correct 1 ms 824 KB Output is correct
7 Correct 11 ms 2736 KB Output is correct
8 Correct 12 ms 2624 KB Output is correct
9 Correct 9 ms 2584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 2 ms 724 KB Output is correct
6 Correct 1 ms 824 KB Output is correct
7 Correct 11 ms 2736 KB Output is correct
8 Correct 12 ms 2624 KB Output is correct
9 Correct 9 ms 2584 KB Output is correct
10 Correct 126 ms 18808 KB Output is correct
11 Correct 99 ms 18868 KB Output is correct
12 Correct 57 ms 11504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 2 ms 724 KB Output is correct
6 Correct 1 ms 824 KB Output is correct
7 Correct 11 ms 2736 KB Output is correct
8 Correct 12 ms 2624 KB Output is correct
9 Correct 9 ms 2584 KB Output is correct
10 Correct 126 ms 18808 KB Output is correct
11 Correct 99 ms 18868 KB Output is correct
12 Correct 57 ms 11504 KB Output is correct
13 Correct 1085 ms 140160 KB Output is correct
14 Correct 1092 ms 140152 KB Output is correct
15 Correct 946 ms 129540 KB Output is correct