답안 #334533

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
334533 2020-12-09T10:39:12 Z beksultan04 Bomb (IZhO17_bomb) C++14
60 / 100
482 ms 131076 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define OK puts("OK");
#define fr first
#define sc second
#define ret return
#define scan1(a) scanf("%lld",&a);
#define scan2(a,b) scanf("%lld %lld",&a, &b);
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define pb push_back
#define endi puts("");
const int N = 1e5+12,INF=1e9+7;
int q[2501][2501],dp[N],up[2501][2501],down[2501][2501],ans[N];

main(){
    int n,m,i,j,X=INF,Y=INF;
    scan2(n,m)
    for (i=1;i<=n;++i)
        for (j=1;j<=m;++j){
            char ch;
            cin>>ch;
            q[i][j]=ch-'0';
        }


    for (i=1;i<=n;++i){
        for (j=1;j<=m;++j){
            if (q[i][j]){
                up[i][j] = 1+up[i-1][j];
                if (q[i+1][j] == 0)Y = min(Y,up[i][j]);
            }
        }
    }
    for (i=n;i>0;--i){
        for (j=m;j>0;--j){
            if (q[i][j]){
                down[i][j] = 1+down[i+1][j];
                if (q[i-1][j] == 0)X = min(X,down[i][j]);
            }
        }
    }
/// /// /// ///
    for (i=1;i<=Y;++i){
        ans[i]=X;
    }
    for (i=1;i<=n;++i){
        int a=INF,b=INF,c=0;
        for (j=1;j<=m;++j){
            if (q[i][j] == 0){
                if (c != 0)
                X = min(X,c);
                a=b=INF;
                c=0;
            }
            else {
                a = min(a,down[i][j]);
                b = min(b,up[i][j]);
                c++;
                ans[c] = min(ans[c],b+a-1);
            }
        }


        a=INF,b=INF,c=0;
        for (j=m;j>0;--j){
            if (q[i][j] == 0){
                if (c != 0)
                X = min(X,c);
                a=b=INF;
                c=0;
            }
            else {
                a = min(a,down[i][j]);
                b = min(b,up[i][j]);
                c++;
                ans[c] = min(ans[c],b+a-1);
            }
        }
    }

/// /// /// ///
    int mx = 0;

    for (i=1;i<=X;++i){
        mx = max(mx,ans[i]*i);
    }
    cout <<mx;


}




Compilation message

bomb.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 | main(){
      |      ^
bomb.cpp: In function 'int main()':
bomb.cpp:10:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 | #define scan2(a,b) scanf("%lld %lld",&a, &b);
      |                    ~~~~~^~~~~~~~~~~~~~~~~~~~
bomb.cpp:20:5: note: in expansion of macro 'scan2'
   20 |     scan2(n,m)
      |     ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Incorrect 1 ms 492 KB Output isn't correct
3 Incorrect 16 ms 30572 KB Output isn't correct
4 Incorrect 17 ms 30572 KB Output isn't correct
5 Incorrect 1 ms 364 KB Output isn't correct
6 Incorrect 1 ms 364 KB Output isn't correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 1 ms 492 KB Output is correct
10 Correct 1 ms 492 KB Output is correct
11 Correct 1 ms 620 KB Output is correct
12 Correct 1 ms 492 KB Output is correct
13 Incorrect 1 ms 492 KB Output isn't correct
14 Correct 1 ms 492 KB Output is correct
15 Correct 1 ms 492 KB Output is correct
16 Incorrect 1 ms 640 KB Output isn't correct
17 Incorrect 1 ms 1132 KB Output isn't correct
18 Correct 1 ms 1004 KB Output is correct
19 Correct 2 ms 1260 KB Output is correct
20 Correct 2 ms 1260 KB Output is correct
21 Correct 1 ms 768 KB Output is correct
22 Correct 1 ms 1004 KB Output is correct
23 Correct 2 ms 1260 KB Output is correct
24 Correct 1 ms 1132 KB Output is correct
25 Correct 2 ms 1664 KB Output is correct
26 Correct 2 ms 1772 KB Output is correct
27 Incorrect 9 ms 5868 KB Output isn't correct
28 Correct 9 ms 2924 KB Output is correct
29 Correct 13 ms 7660 KB Output is correct
30 Correct 16 ms 6892 KB Output is correct
31 Correct 13 ms 5100 KB Output is correct
32 Correct 14 ms 6252 KB Output is correct
33 Correct 18 ms 8172 KB Output is correct
34 Correct 7 ms 3052 KB Output is correct
35 Incorrect 17 ms 4480 KB Output isn't correct
36 Correct 20 ms 10732 KB Output is correct
37 Incorrect 1 ms 620 KB Output isn't correct
38 Runtime error 463 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
39 Correct 1 ms 620 KB Output is correct
40 Incorrect 67 ms 29804 KB Output isn't correct
41 Correct 1 ms 620 KB Output is correct
42 Correct 2 ms 1772 KB Output is correct
43 Correct 475 ms 131072 KB Output is correct
44 Correct 19 ms 9452 KB Output is correct
45 Correct 482 ms 131072 KB Output is correct
46 Runtime error 465 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
47 Correct 472 ms 131072 KB Output is correct
48 Incorrect 479 ms 131072 KB Output isn't correct
49 Runtime error 460 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
50 Runtime error 465 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
51 Incorrect 476 ms 131072 KB Output isn't correct
52 Incorrect 476 ms 131072 KB Output isn't correct
53 Incorrect 471 ms 130428 KB Output isn't correct
54 Incorrect 465 ms 110444 KB Output isn't correct
55 Incorrect 455 ms 106732 KB Output isn't correct
56 Runtime error 458 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
57 Incorrect 450 ms 95744 KB Output isn't correct
58 Incorrect 453 ms 101612 KB Output isn't correct
59 Incorrect 454 ms 97704 KB Output isn't correct
60 Correct 473 ms 121324 KB Output is correct
61 Runtime error 458 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
62 Runtime error 459 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
63 Runtime error 448 ms 131072 KB Execution killed with signal 9 (could be triggered by violating memory limits)
64 Correct 453 ms 99052 KB Output is correct
65 Correct 467 ms 129132 KB Output is correct
66 Incorrect 465 ms 124652 KB Output isn't correct
67 Runtime error 456 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
68 Runtime error 455 ms 131072 KB Execution killed with signal 9 (could be triggered by violating memory limits)
69 Incorrect 447 ms 95388 KB Output isn't correct
70 Correct 281 ms 55020 KB Output is correct
71 Correct 438 ms 82924 KB Output is correct
72 Correct 448 ms 93036 KB Output is correct
73 Correct 453 ms 95212 KB Output is correct
74 Correct 447 ms 95596 KB Output is correct
75 Correct 450 ms 98028 KB Output is correct
76 Correct 448 ms 100204 KB Output is correct
77 Correct 455 ms 101444 KB Output is correct
78 Correct 449 ms 101228 KB Output is correct
79 Correct 430 ms 58732 KB Output is correct
80 Correct 425 ms 60164 KB Output is correct
81 Correct 425 ms 61804 KB Output is correct
82 Correct 459 ms 105196 KB Output is correct
83 Correct 452 ms 104812 KB Output is correct
84 Incorrect 425 ms 54120 KB Output isn't correct
85 Correct 453 ms 102192 KB Output is correct
86 Runtime error 465 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
87 Incorrect 466 ms 100096 KB Output isn't correct
88 Correct 458 ms 103916 KB Output is correct
89 Correct 470 ms 120300 KB Output is correct
90 Correct 298 ms 73964 KB Output is correct
91 Correct 469 ms 109548 KB Output is correct
92 Correct 466 ms 120428 KB Output is correct
93 Runtime error 454 ms 131072 KB Execution killed with signal 9 (could be triggered by violating memory limits)
94 Correct 468 ms 120556 KB Output is correct
95 Correct 455 ms 104940 KB Output is correct
96 Correct 452 ms 104556 KB Output is correct
97 Runtime error 461 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
98 Correct 456 ms 104300 KB Output is correct
99 Correct 464 ms 118892 KB Output is correct
100 Runtime error 461 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)