# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
654973 | 2022-11-02T09:57:27 Z | berr | Programiranje (COCI17_programiranje) | C++17 | 38 ms | 10724 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 468 KB | Output is correct |
2 | Correct | 1 ms | 468 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 1 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 32 ms | 10708 KB | Output is correct |
7 | Correct | 36 ms | 10700 KB | Output is correct |
8 | Correct | 38 ms | 10700 KB | Output is correct |
9 | Correct | 36 ms | 10664 KB | Output is correct |
10 | Correct | 32 ms | 10724 KB | Output is correct |