Submission #115712

#TimeUsernameProblemLanguageResultExecution timeMemory
115712Leonardo_PaesProgramiranje (COCI17_programiranje)C++11
80 / 80
162 ms6264 KiB
#include <bits/stdc++.h> #define MAXN 50010 using namespace std; int prefix[30][MAXN]; int main() { string s; cin >> s; for(int i = 0 ; i < s.size() ; i++) { prefix[s[i]-97][i+1] = 1; } for(int i = 0 ; i < s.size() ; i++) { for(int j = 0 ; j < 28 ; j++) { if(i != 0) prefix[j][i+1] += prefix[j][i]; // if(j < 2) cout << prefix[j][i+1] << ' '; } //cout << endl; } int q; cin >> q; for(int i = 0 ; i < q ; i++) { int a, b, c, d; cin >> a >> b >> c >> d; bool ok = true; if(b-a == d-c) { //cout << "hey\n"; for(int i = 0 ; i < 26 ; i++) { int k1 = prefix[i][b]-prefix[i][a-1]; int k2 = prefix[i][d]-prefix[i][c-1]; //cout << i << ' ' << k1 << ' ' << k2 << endl; if(k1 != k2) ok = false; } } else ok = false; if(ok) cout << "DA\n"; else cout << "NE\n"; } }

Compilation message (stderr)

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