Submission #115708

#TimeUsernameProblemLanguageResultExecution timeMemory
115708luciocfProgramiranje (COCI17_programiranje)C++14
80 / 80
45 ms5752 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 5e4+10; const int maxc = 30; int freq[maxc][maxn]; int main(void) { string s; cin >> s; int n = s.size(); for (int i = 0; i < n; i++) { for (int j = 0; j < 26; j++) freq[j][i+1] = freq[j][i]; freq[(int)s[i]-(int)'a'][i+1] = freq[(int)s[i]-(int)'a'][i]+1; } int q; scanf("%d", &q); for (int i = 1; i <= q; i++) { int a, b, c, d; scanf("%d %d %d %d", &a, &b, &c, &d); if (b-a != d-c) { printf("NE\n"); continue; } bool ok = 1; for (int j = 0; j < 26; j++) if (freq[j][b]-freq[j][a-1] != freq[j][d]-freq[j][c-1]) ok = 0; if (ok) printf("DA\n"); else printf("NE\n"); } }

Compilation message (stderr)

programiranje.cpp: In function 'int main()':
programiranje.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &q);
  ~~~~~^~~~~~~~~~
programiranje.cpp:31:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d %d", &a, &b, &c, &d);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...