제출 #371147

#제출 시각아이디문제언어결과실행 시간메모리
371147daniel920712Hedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
21 / 100
614 ms14320 KiB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>

using namespace std;
int all[1000005];
int last[1000005];
int main()
{
    int N,M,x,y,z,t,i,j;
    scanf("%d %d",&N,&M);
    for(i=1;i<=N;i++) scanf("%d",&all[i]);
    if(N<=500&&M<=500)
    {
        while(M--)
        {
            scanf("%d %d %d",&x,&y,&z);
            t=0;
            for(i=x;i<=y;i++)
            {
                for(j=i+1;j<=y;j++)
                {
                    if(all[i]>all[j]&&all[i]+all[j]>z)
                    {

                        t++;
                    }
                }
            }
            if(t==0) printf("1\n");
            else printf("0\n");
        }
    }
    else
    {
        last[1]=1;
        for(i=2;i<=N;i++)
        {
            if(all[i]>=all[i-1]) last[i]=last[i-1];
            else last[i]=i;
        }
        while(M--)
        {
            scanf("%d %d %d",&x,&y,&z);
            if(last[y]<=x) printf("1\n");
            else printf("0\n");
        }

    }
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   11 |     scanf("%d %d",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~
sortbooks.cpp:12:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 |     for(i=1;i<=N;i++) scanf("%d",&all[i]);
      |                       ~~~~~^~~~~~~~~~~~~~
sortbooks.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |             scanf("%d %d %d",&x,&y,&z);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
sortbooks.cpp:44:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   44 |             scanf("%d %d %d",&x,&y,&z);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...