Submission #173263

# Submission time Handle Problem Language Result Execution time Memory
173263 2020-01-03T17:10:31 Z mosiashvililuka Intergalactic ship (IZhO19_xorsum) C++14
0 / 100
13 ms 10356 KB
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f[1000009],i,j,zx,xc,qq,l,r;
int main(){
    scanf("%d%d\n",&a,&b);
    for(i=1; i<=a; i++) scanf("%d",&f[i]);
    scanf("\n");
    if(a<=5000){
        short z[5009][5009],x[5009][5009],mx[5009][5009];
        for(i=1; i<=a; i++){
            z[i][0]=0;
            for(j=1; j<i; j++){
                if(f[j]<=f[i]) z[i][j]=z[i][j-1]+1; else z[i][j]=z[i][j-1];
            }
            x[i][a+1]=0;
            for(j=a; j>i; j--){
                if(f[j]<f[i]) x[i][j]=x[i][j+1]+1; else x[i][j]=x[i][j+1];
            }
        }
        for(i=1; i<=a; i++){
            mx[i][i]=f[i];
            for(j=i-1; j>=1; j--){
                if(mx[j+1][i]<=f[j]) mx[j][i]=f[j]; else mx[j][i]=mx[j+1][i];
            }
        }
        for(qq=1; qq<=b; qq++){
            scanf("%d%d%d\n",&l,&r,&e);
//            return 0;
            bool bo=0;
            for(i=l; i<=r; i++){
                c=z[i][i-1];
                c=c-z[i][l-1];
//                if(qq==2) cout<<f[i]<<" "<<c<<endl;
                if(l+c<i){
                    if(mx[l+c][i-1]+f[i]>e){
                        bo=1;
                        break;
                    }
                }
            }
            if(bo==0) printf("1\n"); else printf("0\n");
        }
    }
    return 0;
}

Compilation message

xorsum.cpp: In function 'int main()':
xorsum.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d\n",&a,&b);
     ~~~~~^~~~~~~~~~~~~~~~
xorsum.cpp:6:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1; i<=a; i++) scanf("%d",&f[i]);
                         ~~~~~^~~~~~~~~~~~
xorsum.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("\n");
     ~~~~~^~~~~~
xorsum.cpp:27:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d%d\n",&l,&r,&e);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 1144 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 10356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -