Submission #40080

# Submission time Handle Problem Language Result Execution time Memory
40080 2018-01-26T13:16:14 Z Hebisuke Programiranje (COCI17_programiranje) C++14
80 / 80
48 ms 6448 KB
#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

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 time Memory Grader output
1 Correct 1 ms 6448 KB Output is correct
2 Correct 0 ms 6448 KB Output is correct
3 Correct 1 ms 6448 KB Output is correct
4 Correct 1 ms 6448 KB Output is correct
5 Correct 1 ms 6448 KB Output is correct
6 Correct 48 ms 6448 KB Output is correct
7 Correct 35 ms 6448 KB Output is correct
8 Correct 30 ms 6448 KB Output is correct
9 Correct 30 ms 6448 KB Output is correct
10 Correct 39 ms 6448 KB Output is correct