# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1275239 | SmuggingSpun | Programiranje (COCI17_programiranje) | C++20 | 17 ms | 5736 KiB |
#include<bits/stdc++.h>
#define taskname "B"
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
string s;
int q;
cin >> s >> q;
vector<vector<int>>cnt(26, vector<int>(s.size() + 1, 0));
for(int i = 0; i < s.size(); i++){
cnt[s[i] - 'a'][i + 1]++;
}
for(int i = 0; i < 26; i++){
for(int j = 1; j <= s.size(); j++){
cnt[i][j] += cnt[i][j - 1];
}
}
for(int _ = 0; _ < q; _++){
int x, y, u, v;
cin >> x >> y >> u >> v;
bool ans = true;
for(int i = 0; i < 26; i++){
if(cnt[i][y] - cnt[i][x - 1] != cnt[i][v] - cnt[i][u - 1]){
ans = false;
break;
}
}
cout << (ans ? "DA\n" : "NE\n");
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |