Submission #1071234

#TimeUsernameProblemLanguageResultExecution timeMemory
107123412345678Cultivation (JOI17_cultivation)C++17
5 / 100
2061 ms1116 KiB
#include <bits/stdc++.h> using namespace std; const int nx=305; int sr, sc, n, a[nx], b[nx], vs[nx][nx], res=INT_MAX; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>sr>>sc>>n; for (int i=1; i<=n; i++) cin>>a[i]>>b[i]; for (int up=0; up<sr; up++) { for (int dn=0; dn<sr; dn++) { for (int l=0; l<sc; l++) { for (int r=0; r<sc; r++) { for (int i=1; i<=sr; i++) for (int j=1; j<=sc ;j++) vs[i][j]=0; for (int i=1; i<=n; i++) for (int j=max(1, a[i]-up); j<=min(sr, a[i]+dn); j++) for (int k=max(1, b[i]-l); k<=min(sc, b[i]+r); k++) vs[j][k]=1; bool f=0; for (int i=1; i<=sr; i++) for (int j=1; j<=sc; j++) if (!vs[i][j]) f=1; if (!f) res=min(res, up+dn+l+r); } } } } cout<<res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...