Submission #1301611

#TimeUsernameProblemLanguageResultExecution timeMemory
1301611Faisal_SaqibProgramiranje (COCI17_programiranje)C++20
80 / 80
50 ms5660 KiB
#include <iostream> #include <map> using namespace std; const int N=5e4+1; int pre[N][26]; int main() { ios::sync_with_stdio(0); cout.tie(0); cin.tie(0); string s; cin>>s; int n=s.size(); for(int i=0;i<n;i++) { for(int j=0;j<26;j++) { pre[i+1][j]=pre[i][j]+((s[i]-'a')==j); } } int q; cin>>q; while(q--) { int a,b,c,d; cin>>a>>b>>c>>d; bool pos=1; for(int j=0;j<26;j++) { if(pre[b][j]-pre[a-1][j] != pre[d][j]-pre[c-1][j]) { pos=0; } } cout<<(pos?"DA":"NE")<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...