# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
624796 | rm1729 | Programiranje (COCI17_programiranje) | C++17 | 134 ms | 11892 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;
#define int long long
void solve(){
string a;
cin >>a;
vector <vector <int>> pref(26, vector <int> (a.length()+1,0));
for(int i=1; i<=a.length(); i++){
for(int j=0; j<26; j++){
pref[j][i]=pref[j][i-1];
}
int x = (int) a[i-1]-97;
pref[x][i]++;
}
int Q;
cin >>Q;
for(int i=0; i<Q; i++){
int a,b,c,d;
cin >>a>>b>>c>>d;
bool flag = false;
for(int j=0; j<26; j++){
if(pref[j][b]-pref[j][a-1]!=pref[j][d]-pref[j][c-1]){
flag = true;
break;
}
}
if(flag){
cout <<"NE"<<endl;
}
else{
cout <<"DA"<<endl;
}
}
}
signed main(){
int t=1;// cin >>t;
while(t--){
solve();
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |