Submission #171920

# Submission time Handle Problem Language Result Execution time Memory
171920 2019-12-30T15:51:16 Z mosiashvililuka Bomb (IZhO17_bomb) C++14
20 / 100
561 ms 61840 KB
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,lf,rg,pas1,pas2,zx,xc,zm[2509][2509],qv[2509][2509];
char ch;
bool f[2509][2509];
int main(){
    scanf("%d %d\n",&a,&b);
    pas1=a+b+2;pas2=a+b+2;
    for(c=1; c<=a; c++){
        for(d=1; d<=b; d++){
            scanf("%c",&ch);
            if(ch=='1') f[c][d]=1;
        }
        scanf("\n");
    }
    for(d=1; d<=b; d++){
        for(c=1; c<=a; c++){
            if(f[c][d]==1){
                zm[c][d]=zm[c-1][d]+1;
            }
        }
        for(c=a; c>=1; c--){
            if(f[c][d]==1){
                qv[c][d]=qv[c+1][d]+1;
            }
        }
    }
    for(c=1; c<=a; c++){
        lf=a+b+2;rg=a+b+2;
        zx=0;
        for(d=1; d<=b; d++){
            if(f[c][d]==1){
                zx++;
                if(lf>zm[c][d]) lf=zm[c][d];
                if(rg>qv[c][d]) rg=qv[c][d];
            }else{
                if(zx!=0){
                    if(pas1>zx) pas1=zx;
                    if(pas2>lf+rg-1) pas2=lf+rg-1;
                }
                zx=0;lf=a+b+2;rg=a+b+2;
            }
        }
        if(zx!=0){
                    if(pas1>zx) pas1=zx;
                    if(pas2>lf+rg+1) pas2=lf+rg-1;
                }
    }
    cout<<pas1*pas2;
    return 0;
}

Compilation message

bomb.cpp: In function 'int main()':
bomb.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d\n",&a,&b);
     ~~~~~^~~~~~~~~~~~~~~~~
bomb.cpp:11:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%c",&ch);
             ~~~~~^~~~~~~~~~
bomb.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("\n");
         ~~~~~^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 504 KB Output isn't correct
3 Correct 22 ms 26532 KB Output is correct
4 Correct 22 ms 26488 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Incorrect 2 ms 504 KB Output isn't correct
9 Incorrect 2 ms 504 KB Output isn't correct
10 Incorrect 2 ms 504 KB Output isn't correct
11 Incorrect 2 ms 504 KB Output isn't correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 504 KB Output is correct
14 Correct 2 ms 504 KB Output is correct
15 Incorrect 2 ms 504 KB Output isn't correct
16 Incorrect 2 ms 632 KB Output isn't correct
17 Incorrect 3 ms 1016 KB Output isn't correct
18 Incorrect 2 ms 760 KB Output isn't correct
19 Incorrect 3 ms 1016 KB Output isn't correct
20 Incorrect 3 ms 1020 KB Output isn't correct
21 Incorrect 2 ms 504 KB Output isn't correct
22 Incorrect 3 ms 760 KB Output isn't correct
23 Incorrect 3 ms 1016 KB Output isn't correct
24 Incorrect 3 ms 1016 KB Output isn't correct
25 Incorrect 4 ms 1400 KB Output isn't correct
26 Incorrect 4 ms 1400 KB Output isn't correct
27 Correct 9 ms 4224 KB Output is correct
28 Incorrect 8 ms 1016 KB Output isn't correct
29 Incorrect 12 ms 5368 KB Output isn't correct
30 Incorrect 14 ms 3960 KB Output isn't correct
31 Incorrect 11 ms 2936 KB Output isn't correct
32 Incorrect 12 ms 3964 KB Output isn't correct
33 Incorrect 15 ms 5240 KB Output isn't correct
34 Incorrect 7 ms 1144 KB Output isn't correct
35 Incorrect 13 ms 1116 KB Output isn't correct
36 Incorrect 17 ms 6748 KB Output isn't correct
37 Correct 2 ms 504 KB Output is correct
38 Correct 561 ms 61532 KB Output is correct
39 Incorrect 2 ms 504 KB Output isn't correct
40 Incorrect 66 ms 16376 KB Output isn't correct
41 Incorrect 2 ms 504 KB Output isn't correct
42 Incorrect 3 ms 1528 KB Output isn't correct
43 Incorrect 510 ms 57884 KB Output isn't correct
44 Incorrect 16 ms 6264 KB Output isn't correct
45 Incorrect 505 ms 57972 KB Output isn't correct
46 Correct 475 ms 61800 KB Output is correct
47 Incorrect 487 ms 59188 KB Output isn't correct
48 Incorrect 459 ms 59628 KB Output isn't correct
49 Incorrect 553 ms 61368 KB Output isn't correct
50 Incorrect 465 ms 61728 KB Output isn't correct
51 Incorrect 490 ms 61688 KB Output isn't correct
52 Incorrect 461 ms 60664 KB Output isn't correct
53 Incorrect 467 ms 61124 KB Output isn't correct
54 Incorrect 414 ms 48248 KB Output isn't correct
55 Incorrect 388 ms 46280 KB Output isn't correct
56 Correct 549 ms 61148 KB Output is correct
57 Incorrect 374 ms 40360 KB Output isn't correct
58 Incorrect 400 ms 46688 KB Output isn't correct
59 Incorrect 380 ms 43000 KB Output isn't correct
60 Correct 441 ms 53496 KB Output is correct
61 Correct 551 ms 61816 KB Output is correct
62 Correct 561 ms 61688 KB Output is correct
63 Correct 553 ms 61688 KB Output is correct
64 Correct 382 ms 44668 KB Output is correct
65 Incorrect 456 ms 60640 KB Output isn't correct
66 Incorrect 455 ms 56952 KB Output isn't correct
67 Incorrect 482 ms 61788 KB Output isn't correct
68 Incorrect 498 ms 61840 KB Output isn't correct
69 Incorrect 382 ms 39904 KB Output isn't correct
70 Incorrect 200 ms 16248 KB Output isn't correct
71 Incorrect 340 ms 32352 KB Output isn't correct
72 Incorrect 365 ms 37496 KB Output isn't correct
73 Incorrect 373 ms 38524 KB Output isn't correct
74 Incorrect 370 ms 40568 KB Output isn't correct
75 Incorrect 396 ms 42464 KB Output isn't correct
76 Incorrect 404 ms 42616 KB Output isn't correct
77 Incorrect 388 ms 44536 KB Output isn't correct
78 Incorrect 384 ms 43512 KB Output isn't correct
79 Incorrect 287 ms 13332 KB Output isn't correct
80 Incorrect 290 ms 15152 KB Output isn't correct
81 Incorrect 300 ms 15248 KB Output isn't correct
82 Incorrect 417 ms 47736 KB Output isn't correct
83 Incorrect 423 ms 47992 KB Output isn't correct
84 Incorrect 281 ms 7288 KB Output isn't correct
85 Incorrect 389 ms 47108 KB Output isn't correct
86 Incorrect 535 ms 60632 KB Output isn't correct
87 Correct 378 ms 45896 KB Output is correct
88 Incorrect 400 ms 46404 KB Output isn't correct
89 Incorrect 438 ms 55672 KB Output isn't correct
90 Incorrect 231 ms 33400 KB Output isn't correct
91 Incorrect 410 ms 50872 KB Output isn't correct
92 Incorrect 463 ms 52508 KB Output isn't correct
93 Incorrect 535 ms 59640 KB Output isn't correct
94 Incorrect 433 ms 54396 KB Output isn't correct
95 Incorrect 395 ms 47992 KB Output isn't correct
96 Incorrect 393 ms 47536 KB Output isn't correct
97 Incorrect 548 ms 60420 KB Output isn't correct
98 Incorrect 394 ms 47352 KB Output isn't correct
99 Incorrect 430 ms 53980 KB Output isn't correct
100 Incorrect 527 ms 59440 KB Output isn't correct