Submission #38170

#TimeUsernameProblemLanguageResultExecution timeMemory
38170wasylProgramiranje (COCI17_programiranje)C++11
80 / 80
369 ms7552 KiB
#include <vector> #include <iostream> #include <algorithm> #define d(...) __VA_ARGS__ #define all(x) (x).begin(), (x).end() #define eb(...) emplace_back(__VA_ARGS__) using namespace std;using ll=long long; template<class t>using V = vector< t >; V< V< int > > tab; V< int > foo (int lo, int hi) { V< int > res (26); for (int i = 0; i < 26; ++i) res[i] = tab[i][hi] - tab[i][lo - 1]; return res; } int main() { ios::sync_with_stdio(false); string s; cin >> s; s = 'a' + s; tab.resize(26, V< int >(s.size())); for (int i = 0; i < s.size(); ++i) ++tab[s[i] - 'a'][i]; for (int i = 0; i < 26; ++i) for (int k = 1; k < s.size(); ++k) tab[i][k] += tab[i][k - 1]; int q; cin >> q; while (q--) { int lo, hi, lo2, hi2; cin >> lo >> hi >> lo2 >> hi2; V< int > z = foo(lo, hi); V< int > z2 = foo(lo2, hi2); int i = 0; for (; i < 26; ++i) if (z[i] != z2[i]) { cout << "NE\n"; break; } if (i == 26) cout << "DA\n"; } }

Compilation message (stderr)

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