# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
115705 | 2019-06-08T17:42:47 Z | pamaj | Programiranje (COCI17_programiranje) | C++14 | 143 ms | 7772 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e4 + 10; int pref[MAXN][30]; int main() { string s; cin >> s; for(int i = 0; i < s.size(); i++) { for(int lt = 0; lt < 26; lt++) { pref[i + 1][lt] = pref[i][lt] + (s[i] - 'a' == lt); } } int q; cin >> q; while(q--) { int a, b, c, d; cin >> a >> b >> c >> d; bool ok = true; for(int i = 0; i < 30; i++) { int qt1, qt2; qt1 = pref[b][i] - pref[a - 1][i]; qt2 = pref[d][i] - pref[c - 1][i]; if(qt1 != qt2) { ok = false; break; } } if(ok) cout << "DA\n"; else cout << "NE\n"; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 4 ms | 512 KB | Output is correct |
3 | Correct | 4 ms | 512 KB | Output is correct |
4 | Correct | 5 ms | 512 KB | Output is correct |
5 | Correct | 4 ms | 512 KB | Output is correct |
6 | Correct | 139 ms | 7772 KB | Output is correct |
7 | Correct | 138 ms | 7544 KB | Output is correct |
8 | Correct | 141 ms | 7620 KB | Output is correct |
9 | Correct | 137 ms | 7692 KB | Output is correct |
10 | Correct | 143 ms | 7672 KB | Output is correct |