답안 #94622

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94622 2019-01-21T20:03:23 Z ahmedie404 Programiranje (COCI17_programiranje) C++14
0 / 80
4 ms 1144 KB
#include <iostream>

using namespace std;

string s, s1, s2;
int n;

int a, b, c, d;

int x[27];
int y[27];

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==true)
            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++)
                     ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 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 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 4 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 4 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 4 ms 1016 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 4 ms 888 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 4 ms 1144 KB Execution killed with signal 11 (could be triggered by violating memory limits)