# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
654973 | berr | Programiranje (COCI17_programiranje) | C++17 | 38 ms | 10724 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
int e[50005][26];
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
string s; cin>>s;
for(int i=0; i<s.size(); i++)
{
for(int l=0; l<26&&i>0; l++)
{
e[i][l]=e[i-1][l];
}
e[i][s[i]-'a']++;
}
int q;cin>>q;
while(q--)
{
int a, b, c, d; cin>>a>>b>>c>>d;
a--; b--; c--; d--;
vector<int> f(26), g(26);
for(int i=0; i<26; i++)
{
f[i]=e[b][i];
if(a!=0) f[i]-=e[a-1][i];
g[i]=e[d][i];
if(c!=0) g[i]-=e[c-1][i];
}
if(f==g) cout<<"DA\n";
else cout<<"NE\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |