답안 #115715

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
115715 2019-06-08T18:18:22 Z Breno_XD Programiranje (COCI17_programiranje) C++14
80 / 80
2844 ms 1124 KB
#include <bits/stdc++.h>
using namespace std;

string S;
int a,b,c,d, Q;
int palavra1[100];
int palavra2[100];

int main(){

    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

    cin >> S >> Q;

    for(int i = 1; i<=Q; i++){

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

        for(int k = a; k <= b; k++) palavra1[(int)S[k-1] - 96]++;
        for(int k = c; k <= d; k++) palavra2[(int)S[k-1] - 96]++;

        /*
        for(int k=1; k<=27; k++) cout << palavra1[k] << " ";
        cout << endl;
        for(int k=1; k<=27; k++) cout << palavra2[k] << " ";
        cout << endl;
        */

        bool ok = true;
        for(int k=1; k<=27; k++){

            if(palavra1[k]!=palavra2[k]) ok = false;

            palavra1[k] = palavra2[k] = 0;

        }

        if(ok) cout << "DA\n";
        else cout << "NE\n";
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 2790 ms 960 KB Output is correct
7 Correct 2808 ms 1124 KB Output is correct
8 Correct 2813 ms 1080 KB Output is correct
9 Correct 2844 ms 1028 KB Output is correct
10 Correct 2764 ms 1016 KB Output is correct