Submission #747891

# Submission time Handle Problem Language Result Execution time Memory
747891 2023-05-25T06:21:54 Z boyliguanhan Pyramid Base (IOI08_pyramid_base) C++17
15 / 100
308 ms 262144 KB
#include"stdio.h"
using namespace std;
int arr[10001][10001], n, m, p;
bool check(int l) {
    for(int i = l; i <= n; i++)
        for(int j = l; j <= m; j++)
            if((arr[i][j]-arr[i-l][j] - arr[i][j-l] + arr[i-l][j-l]) == 0) {
                return 1;
            }
    return 0;
}
int main() {
    scanf("%d%d%d%d", &n, &m, &p, &p);
    for(int i = 0; i < p; i++) {
        int a, b, c, d, e;
        scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
        arr[a][b]++;
        arr[a][d+1]--;
        arr[c+1][b]--;
        arr[c+1][d+1]++;
    }
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            arr[i][j] += arr[i-1][j]+arr[i][j-1]-arr[i-1][j-1];
    for(int i = 1; i <= n; i++)
        for(int j = 1; j <= m; j++)
            arr[i][j] += arr[i-1][j]+arr[i][j-1]-arr[i-1][j-1];
    int l = 0, r = (n<m?n:m);
    while(l < r) {
        int mid = l+r+1>>1;
        if(check(mid)) {
            l = mid;
        } else {
            r = mid-1;
        }
    }
    printf("%d", l);
}

Compilation message

pyramid_base.cpp: In function 'int main()':
pyramid_base.cpp:30:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   30 |         int mid = l+r+1>>1;
      |                   ~~~^~
pyramid_base.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d%d%d%d", &n, &m, &p, &p);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
pyramid_base.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 8264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 287 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 308 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 9 ms 324 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -