답안 #88677

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88677 2018-12-07T12:07:42 Z khohko 최솟값 배열 (IZhO11_hyper) C++17
0 / 100
2000 ms 220580 KB
#include<bits/stdc++.h>
using namespace std;
#define ll int
#define pb push_back
#define fr first
#define sc second
#define ARRS int(1e5+11)
#define MAX ((int)(1e9+1))
#define HS1 ((long long)(1000001329))
#define HS2 ((long long)(1000001531))
#define MOD ((long long)1000000007)
#define MD ((long long)1000000007)



ll i,j,l,k,n,m,p,d,mx,x,o,y,ans,res,sum;

ll a[35][35][35][35];
ll mn[36][35][35][35][35];
ll N,pp;
ll go(ll n,ll i,ll j,ll k,ll p){
    if(n==1)
        return mn[n][i][j][k][p]=a[i][j][k][p];
    if(i+n>N)return MAX;
    if(j+n>N)return MAX;
    if(k+n>N)return MAX;
    if(p+n>N)return MAX;

    if(mn[n][i][j][k][p]!=MAX)return mn[n][i][j][k][p];
    mn[n][i][j][k][p]=min({a[i][j][k][p],
             go(n-1,i,j,k,p+1),
             go(n-1,i,j,k+1,p),
             go(n-1,i,j,k+1,p+1),
             go(n-1,i,j+1,k,p),
             go(n-1,i,j+1,k,p+1),
             go(n-1,i,j+1,k+1,p),
             go(n-1,i,j+1,k+1,p+1),
             go(n-1,i+1,j,k,p),
             go(n-1,i+1,j,k,p+1),
             go(n-1,i+1,j,k+1,p),
             go(n-1,i+1,j,k+1,p+1),
             go(n-1,i+1,j+1,k,p),
             go(n-1,i+1,j+1,k,p+1),
             go(n-1,i+1,j+1,k+1,p),
             go(n-1,i+1,j+1,k+1,p+1),
             });
   // cout<<i<<" "<<j<<" "<<k<<" "<<p<<" "<<n<<" "<<mn[n][i][j][k][p]<<endl;
    return mn[n][i][j][k][p];
}

int main(){
    #ifdef KHOKHO
        freopen("in.in","r",stdin);
        freopen("out.out","w+",stdout);
    #endif //KHOKHO
    cin>>n>>m;
    N=n;
    for(i=0; i<n; i++){
    for(j=0; j<n; j++){
    for(k=0; k<n; k++){
    for(p=0; p<n; p++){
        //cin>>a[i][j][k][p];
        scanf("%d",&a[i][j][k][p]);
     //   cout<<a[i][j][k][p]<<" ";
    }}}}//cout<<endl;}cout<<endl;}cout<<endl;}
    for(i=0; i<n; i++)
        for(j=0; j<n; j++)
         for(k=0; k<n; k++)
                for(p=0; p<n; p++)
                for(pp=0; pp<=m; pp++)
                    mn[pp][i][j][k][p]=MAX;
      for(i=0; i<n; i++)
        for(j=0; j<n; j++)
         for(k=0; k<n; k++)
                for(p=0; p<n; p++)
                    go(m,i,j,k,p);

   // go(m,0,0,1,0);
    for(i=0; i<n-m+1; i++){
    for(j=0; j<n-m+1; j++){
    for(k=0; k<n-m+1; k++){
    for(p=0; p<n-m+1; p++){
     //   cin>>a[i][j][k][p];
        printf("%d ",mn[m][i][j][k][p]);
    }}}}

    return 0;
}

Compilation message

hyper.cpp: In function 'int main()':
hyper.cpp:63:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&a[i][j][k][p]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 548 KB Output is correct
2 Correct 3 ms 1176 KB Output is correct
3 Correct 11 ms 6764 KB Output is correct
4 Correct 9 ms 6764 KB Output is correct
5 Correct 8 ms 6764 KB Output is correct
6 Correct 38 ms 9448 KB Output is correct
7 Correct 45 ms 15376 KB Output is correct
8 Correct 164 ms 43028 KB Output is correct
9 Correct 59 ms 43028 KB Output is correct
10 Correct 157 ms 43028 KB Output is correct
11 Correct 392 ms 48608 KB Output is correct
12 Correct 937 ms 86748 KB Output is correct
13 Correct 1257 ms 164624 KB Output is correct
14 Correct 538 ms 164624 KB Output is correct
15 Correct 522 ms 164624 KB Output is correct
16 Execution timed out 2043 ms 220580 KB Time limit exceeded
17 Halted 0 ms 0 KB -