Submission #1071255

#TimeUsernameProblemLanguageResultExecution timeMemory
107125512345678Cultivation (JOI17_cultivation)C++17
15 / 100
471 ms1236 KiB
#include <bits/stdc++.h> #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using namespace std; const int nx=305; int sr, sc, n, a[nx], b[nx], qs[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++) { if (up+dn+l+r>sr+sc||up+dn+l+r>=res) continue; for (int i=1; i<=sr; i++) for (int j=1; j<=sc ;j++) qs[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++) qs[j][max(1, b[i]-l)]++, qs[j][min(sc, b[i]+r)+1]--; for (int i=1; i<=sr; i++) for (int j=1; j<=sc; j++) qs[i][j]+=qs[i][j-1]; bool f=0; for (int i=1; i<=sr; i++) for (int j=1; j<=sc; j++) if (qs[i][j]==0) 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...