Submission #500442

# Submission time Handle Problem Language Result Execution time Memory
500442 2021-12-31T06:18:42 Z kappa Programiranje (COCI17_programiranje) C++14
80 / 80
594 ms 65080 KB
#include <bits/stdc++.h>

using namespace std;

int q, a, b, c, d;

string str;

map<char,int> mp[50005];

map<char,int> del(map<char,int> a, map<char,int> b){
    map<char,int> r;

    for (int i = 0; i < 26; i++)
    {
        r['a' + i] = a['a' + i] - b['a' + i];
    }

    return r;
}

int main(){
    cin >> str;

    for (int i = 1; i <= str.length(); i++)
    {
        mp[i] = mp[i - 1];
        mp[i][str[i - 1]]++;
    }

    cin >> q;

    while(q--){
        cin >> a >> b >> c >> d;

        if(del(mp[b], mp[a - 1]) == del(mp[d], mp[c - 1])){
            cout << "DA\n";
        }else{
            cout << "NE\n";
        }
    }
}

Compilation message

programiranje.cpp: In function 'int main()':
programiranje.cpp:25:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (int i = 1; i <= str.length(); i++)
      |                     ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 11 ms 3788 KB Output is correct
2 Correct 18 ms 3788 KB Output is correct
3 Correct 13 ms 3788 KB Output is correct
4 Correct 12 ms 3788 KB Output is correct
5 Correct 12 ms 3788 KB Output is correct
6 Correct 573 ms 64956 KB Output is correct
7 Correct 573 ms 64992 KB Output is correct
8 Correct 566 ms 64996 KB Output is correct
9 Correct 594 ms 65080 KB Output is correct
10 Correct 563 ms 64968 KB Output is correct