Submission #40080

#TimeUsernameProblemLanguageResultExecution timeMemory
40080HebisukeProgramiranje (COCI17_programiranje)C++14
80 / 80
48 ms6448 KiB
#include "stdio.h"
#include "string.h"

int q,l,co[50100][27],a,b,c,d;
char w[50500];
main()
{
    scanf("%s",w);
    l = strlen(w);

    scanf("%d",&q);

    for(int i=1;i<=l;i++)
    {
        for(int j=0;j<26;j++) co[i][j]=co[i-1][j];
        co[i][w[i-1]-'a']++;
    }

    for(int i=0;i<q;i++)
    {
        scanf("%d %d %d %d",&a,&b,&c,&d);
        int ch=1;
        for(int j=0;j<26;j++)
            if(co[b][j]-co[a-1][j]!=co[d][j]-co[c-1][j]) {ch=0;break;}
        if(ch) printf("DA\n");
        else printf("NE\n");
    }
}

Compilation message (stderr)

programiranje.cpp:6:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
programiranje.cpp: In function 'int main()':
programiranje.cpp:8:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",w);
                  ^
programiranje.cpp:11:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&q);
                   ^
programiranje.cpp:21:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d %d %d",&a,&b,&c,&d);
                                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...