# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
623465 | hail | Programiranje (COCI17_programiranje) | C++17 | 41 ms | 13772 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 vi vector<int>
#define vll vector<long long>
#define pb push_back
using ll= long long;
#define fast_io ios::sync_with_stdio(0); cin.tie(0)
#define inpint(x) int x; cin>>x
#define inpll(x) long long x; cin>>x
#define fl(i, n) for(int i=0; i<n; i++)
#define fl_1(i, n) for(int i=1; i<=n; i++)
#define int long long
#define pi pair<int, int>
#define mp make_pair
#define ld long double
void solve()
{
string s;
cin>>s;
int n = (int)s.size();
s = ' '+s;
int q;
cin>>q;
vector<vector<int>> word(n+1, vector<int>(26, 0));
for(int i=1; i<=n; i++)
{
for(int j=0 ; j<26; j++)
{
word[i][j] = word[i-1][j];
}
char a = s[i];
word[i][a-97]++;
}
while(q--)
{
int a, b, c, d;
cin>>a>>b>>c>>d;
vector<int> x(26, 0);
vector<int> y(26, 0);
for(int i=0; i<26; i++)
{
x[i] = word[b][i] - word[a-1][i];
y[i] = word[d][i] - word[c-1][i];
}
if(x==y) cout<<"DA\n";
else cout<<"NE\n";
}
}
int32_t main()
{
fast_io;
int t=1;
//cin>>t;
while(t--)
{
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |