Submission #288697

#TimeUsernameProblemLanguageResultExecution timeMemory
288697eagle30Colouring a rectangle (eJOI19_colouring)C++14
0 / 100
729 ms12884 KiB
#include<bits/stdc++.h> using namespace std; long long arr1[1000000], arr2[1000000], arr[101][101]; int main(){ long long n, m; cin>>n>>m; for(long long i=0; i<n+m-1; i++) cin>>arr1[i]; for(long long i=0; i<n+m-1; i++) cin>>arr2[i]; long long hi=m+n-1, mini=2e9; for(long long i=0; i<(1<<hi); i++){ for(long long a=0; a<n; a++) for(long long b=0; b<m; b++) arr[a][b]=0; long long tot=0; for(long long j=0; j<hi; j++){ if(i&(1<<j)){ for(long long k=0; k<n; k++) if(j-k>=0 && j-k<m) arr[k][j-k]=1; tot+=arr2[j]; } } set<long long> si; for(long long j=0; j<n; j++){ for(long long k=0; k<m; k++){ if(arr[j][k]==0) si.insert(j-k+n-2); } } for(auto x:si) tot+=arr1[x]; mini=min(mini, tot); } cout<<mini; return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...