# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1032015 | 2024-07-23T10:04:26 Z | 7again | Programiranje (COCI17_programiranje) | C++17 | 4 ms | 5344 KB |
#include <bits/stdc++.h> #define int long long #define endl "\n" #define f first #define s second #define pb push_back #define in insert #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define yes cout<<"Yes\n" #define no cout<<"No\n" #define FAST ios::sync_with_stdio(0);cout.tie(0);cin.tie(0) using namespace std ; void setIO(string s){freopen((s+".in").c_str(),"r",stdin);freopen((s+".out").c_str(),"w",stdout);} const int N = 10000 , MOD = 1e9+7 ; //bool inside(int x,int y){return(x<n&&y<m&&x>-1&&y>-1&&a[x][y]!='#');} //int dx[4]{1 , -1 , 0 , 0} , dy[4]{0 , 0 , 1 , -1} ; int pfx[27][N] ; void slv() { string s ; cin >> s ; int n = s.size() ; fill_n(&pfx[0][0] , (27) * (N) , 0) ; for(int i = 1 ; i <= n ; i++) { for(char c = 'a' ; c <= 'z' ; c++) { if(s[i - 1] == c) pfx[c - 'a'][i]++ ; pfx[c - 'a'][i] += pfx[c - 'a'][i - 1] ; } } int q ; cin >> q ; while(q--) { int l1 , r1 , l2 , r2 , Ok = 1 ; cin >> l1 >> r1 >> l2 >> r2 ; l1-- , l2-- ; for(char c = 'a' ; c <= 'z' ; c++) { if(pfx[c - 'a'][r1] - pfx[c - 'a'][l1] != pfx[c - 'a'][r2] - pfx[c - 'a'][l2]) { cout << "NE" << endl ; Ok = 0 ; break ; } } if(Ok) cout << "DA" << endl ; } } main() { //setIO("lasers") ; FAST ; int t = 1 ; //cin >> t ; while(t--) slv() ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2392 KB | Output is correct |
2 | Correct | 1 ms | 2396 KB | Output is correct |
3 | Correct | 1 ms | 2396 KB | Output is correct |
4 | Correct | 2 ms | 2396 KB | Output is correct |
5 | Correct | 1 ms | 2396 KB | Output is correct |
6 | Runtime error | 4 ms | 5320 KB | Execution killed with signal 11 |
7 | Runtime error | 4 ms | 5212 KB | Execution killed with signal 11 |
8 | Runtime error | 4 ms | 5212 KB | Execution killed with signal 11 |
9 | Runtime error | 4 ms | 5212 KB | Execution killed with signal 11 |
10 | Runtime error | 4 ms | 5344 KB | Execution killed with signal 11 |