# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
89148 | igzi | Programiranje (COCI17_programiranje) | C++17 | 123 ms | 12064 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>
#define maxN 1100005
using namespace std;
string s;
int n,q,a,b,c,d,i,j,x[27][50005];
bool proveri(int a,int b,int c,int d){
for(int i=0;i<27;i++){
if(x[i][b]-x[i][a-1]!=x[i][d]-x[i][c-1]) return false;
}
return true;
}
int main() {
std::ios_base::sync_with_stdio(false);
cin>>s;
n=s.size();
for(i=0;i<n;i++){
for(j=0;j<27;j++){
x[j][i+1]=x[j][i];
}
x[s[i]-'a'][i+1]++;
}
cin>>q;
for(i=0;i<q;i++){
cin>>a>>b>>c>>d;
if(proveri(a,b,c,d)) cout<<"DA"<<endl;
else cout<<"NE"<<endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |