Submission #334315

#TimeUsernameProblemLanguageResultExecution timeMemory
334315beksultan04Bomb (IZhO17_bomb)C++14
21 / 100
463 ms131076 KiB
#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); } } } /// /// /// /// int mx = 0; for (i=1;i<=X;++i){ mx = max(mx,ans[i]*i); } cout <<mx; }

Compilation message (stderr)

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)
      |     ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...