Submission #623465

#TimeUsernameProblemLanguageResultExecution timeMemory
623465hailProgramiranje (COCI17_programiranje)C++17
80 / 80
41 ms13772 KiB
#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 timeMemoryGrader output
Fetching results...