Submission #36278

#TimeUsernameProblemLanguageResultExecution timeMemory
36278KerimHyper-minimum (IZhO11_hyper)C++14
100 / 100
619 ms31324 KiB
#include "bits/stdc++.h" #define MAXN 100009 #define INF 1000000007 #define mp(x,y) make_pair(x,y) #define all(v) v.begin(),v.end() #define pb(x) push_back(x) #define wr cout<<"----------------"<<endl; #define ppb() pop_back() #define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++) #define ff first #define ss second #define my_little_dodge 46 #define debug(x) cerr<< #x <<" = "<< x<<endl; using namespace std; typedef long long ll; typedef pair<int,int> PII; template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} int dp[5][35][35][35][35]; int main(){ //~ freopen("file.in", "r", stdin); int n,m; scanf("%d%d",&n,&m); for(int i=0;i<n;i++) for(int j=0;j<n;j++) for(int k=0;k<n;k++) for(int h=0;h<n;h++) scanf("%d",&dp[4][i][j][k][h]); for(int i=0;i<n;i++) for(int j=0;j<n;j++) for(int k=0;k<n;k++) for(int h=0;h<n;h++){ dp[3][i][j][k][h]=INF; for(int g=h;g<=min(n-1,h+m-1);g++) umin(dp[3][i][j][k][h],dp[4][i][j][k][g]); } for(int i=0;i<n;i++) for(int j=0;j<n;j++) for(int k=0;k<n;k++) for(int h=0;h<n;h++){ dp[2][i][j][k][h]=INF; for(int g=k;g<=min(n-1,k+m-1);g++) umin(dp[2][i][j][k][h],dp[3][i][j][g][h]); } for(int i=0;i<n;i++) for(int j=0;j<n;j++) for(int k=0;k<n;k++) for(int h=0;h<n;h++){ dp[1][i][j][k][h]=INF; for(int g=j;g<=min(n-1,j+m-1);g++) umin(dp[1][i][j][k][h],dp[2][i][g][k][h]); } for(int i=0;i<n;i++) for(int j=0;j<n;j++) for(int k=0;k<n;k++) for(int h=0;h<n;h++){ dp[0][i][j][k][h]=INF; for(int g=i;g<=min(n-1,i+m-1);g++) umin(dp[0][i][j][k][h],dp[1][g][j][k][h]); } for(int i=0;i+m-1<n;i++) for(int j=0;j+m-1<n;j++) for(int k=0;k+m-1<n;k++) for(int h=0;h+m-1<n;h++) printf("%d ",dp[0][i][j][k][h]); puts(""); return 0; }

Compilation message (stderr)

hyper.cpp: In function 'int main()':
hyper.cpp:24:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
                        ^
hyper.cpp:29:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
      scanf("%d",&dp[4][i][j][k][h]);
                                    ^
#Verdict Execution timeMemoryGrader output
Fetching results...