# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86099 | MatesV13 | Programiranje (COCI17_programiranje) | C++11 | 42 ms | 16792 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
long long q, a, b, c, d, e, f, x, ok = 1, slova[26][50000];
string word;
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> word;
for (int i=0;i<word.size();i++){
for (int j=0;j<26;j++) slova[j][i] = slova[j][i-1];
slova[int(word[i])-97][i]++;
}
cin >> q;
for(int i=0;i<q;i++){
cin >> a >> b >> c >> d;
for (int j=0;j<26;j++){
if (a==1) e = slova[j][b-1];
else e = slova[j][b-1] - slova[j][a-2];
if (c==1) f = slova[j][d-1];
else f = slova[j][d-1] - slova[j][c-2];
if (e != f){
ok = 0;
break;
}
}
if (ok) cout << "DA\n";
else cout << "NE\n";
ok = 1;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |