Submission #115705

#TimeUsernameProblemLanguageResultExecution timeMemory
115705pamajProgramiranje (COCI17_programiranje)C++14
80 / 80
143 ms7772 KiB
#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 (stderr)

programiranje.cpp: In function 'int main()':
programiranje.cpp:13:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < s.size(); i++)
                 ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...