Submission #94623

# Submission time Handle Problem Language Result Execution time Memory
94623 2019-01-21T20:10:00 Z ahmedie404 Programiranje (COCI17_programiranje) C++14
0 / 80
4 ms 1016 KB
#include <iostream>

using namespace std;

string s, s1, s2;
int n;

int a, b, c, d;

int x[26];
int y[26];

int main(){

    cin >> s;
    cin >> n;

    while(n--){

        cin >> a >> b >> c >> d;

        if(d-c != b-a){
            cout << "NE" << endl;
            continue;
        }

        s1 = s.substr(a-1,b-a+1);
        s2 = s.substr(c-1,d-c+1);

        for(int i=0;i<26;i++) x[i]=0, y[i]=0;

        for(int i=0;i<s1.length();i++)
            x[(int)s1[i] - 87]++, y[(int)s2[i] - 87]++;

        bool f=true;

        for(int i=0;i<26;i++)
            if(x[i] != y[i]){
                f=false;
                break;
            }

        if(f)
            cout << "DA" << endl;
        else
            cout << "NE" << endl;
    }

    return 0;
}

Compilation message

programiranje.cpp: In function 'int main()':
programiranje.cpp:32:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0;i<s1.length();i++)
                     ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 2 ms 248 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 372 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 4 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 4 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 4 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 4 ms 636 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 4 ms 760 KB Execution killed with signal 11 (could be triggered by violating memory limits)