Submission #88678

# Submission time Handle Problem Language Result Execution time Memory
88678 2018-12-07T12:08:24 Z khohko Hyper-minimum (IZhO11_hyper) C++17
0 / 100
1643 ms 263104 KB
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
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:64: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]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 1020 KB Output is correct
3 Correct 9 ms 6584 KB Output is correct
4 Correct 7 ms 6584 KB Output is correct
5 Correct 7 ms 6584 KB Output is correct
6 Correct 26 ms 8336 KB Output is correct
7 Correct 33 ms 13728 KB Output is correct
8 Correct 122 ms 39844 KB Output is correct
9 Correct 58 ms 39844 KB Output is correct
10 Correct 101 ms 39844 KB Output is correct
11 Correct 228 ms 39844 KB Output is correct
12 Correct 554 ms 67948 KB Output is correct
13 Correct 831 ms 137568 KB Output is correct
14 Correct 328 ms 137568 KB Output is correct
15 Correct 398 ms 137568 KB Output is correct
16 Correct 1197 ms 161072 KB Output is correct
17 Correct 860 ms 161072 KB Output is correct
18 Correct 556 ms 161072 KB Output is correct
19 Correct 1101 ms 161072 KB Output is correct
20 Runtime error 1643 ms 263104 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.