Submission #89148

#TimeUsernameProblemLanguageResultExecution timeMemory
89148igziProgramiranje (COCI17_programiranje)C++17
80 / 80
123 ms12064 KiB
#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 timeMemoryGrader output
Fetching results...