# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
115715 | Breno_XD | Programiranje (COCI17_programiranje) | C++14 | 2844 ms | 1124 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;
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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |