답안 #86099

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
86099 2018-11-24T22:23:06 Z MatesV13 Programiranje (COCI17_programiranje) C++11
80 / 80
42 ms 16792 KB
#include <bits/stdc++.h>
using namespace std;
long long q, a, b, c, d, e, f, x, ok = 1, slova[26][50000];
string word;
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
	cin >> word;
	for (int i=0;i<word.size();i++){
		for (int j=0;j<26;j++) slova[j][i] = slova[j][i-1];
		slova[int(word[i])-97][i]++;
	}
	cin >> q;
	for(int i=0;i<q;i++){
		cin >> a >> b >> c >> d;
		for (int j=0;j<26;j++){
			if (a==1) e = slova[j][b-1];
			else e = slova[j][b-1] - slova[j][a-2];
			if (c==1) f = slova[j][d-1];
			else f = slova[j][d-1] - slova[j][c-2];
			if (e != f){
				ok = 0;
				break;
			}
		}
		if (ok) cout << "DA\n";
		else cout << "NE\n";
		ok = 1;
	}
return 0;
}

Compilation message

programiranje.cpp: In function 'int main()':
programiranje.cpp:9:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i=0;i<word.size();i++){
               ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 760 KB Output is correct
2 Correct 3 ms 904 KB Output is correct
3 Correct 4 ms 904 KB Output is correct
4 Correct 3 ms 940 KB Output is correct
5 Correct 3 ms 1020 KB Output is correct
6 Correct 42 ms 12224 KB Output is correct
7 Correct 40 ms 13500 KB Output is correct
8 Correct 41 ms 14504 KB Output is correct
9 Correct 40 ms 15696 KB Output is correct
10 Correct 41 ms 16792 KB Output is correct