Submission #1275239

#TimeUsernameProblemLanguageResultExecution timeMemory
1275239SmuggingSpunProgramiranje (COCI17_programiranje)C++20
80 / 80
17 ms5736 KiB
#include<bits/stdc++.h> #define taskname "B" using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } string s; int q; cin >> s >> q; vector<vector<int>>cnt(26, vector<int>(s.size() + 1, 0)); for(int i = 0; i < s.size(); i++){ cnt[s[i] - 'a'][i + 1]++; } for(int i = 0; i < 26; i++){ for(int j = 1; j <= s.size(); j++){ cnt[i][j] += cnt[i][j - 1]; } } for(int _ = 0; _ < q; _++){ int x, y, u, v; cin >> x >> y >> u >> v; bool ans = true; for(int i = 0; i < 26; i++){ if(cnt[i][y] - cnt[i][x - 1] != cnt[i][v] - cnt[i][u - 1]){ ans = false; break; } } cout << (ans ? "DA\n" : "NE\n"); } }

Compilation message (stderr)

programiranje.cpp: In function 'int main()':
programiranje.cpp:7:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |                 freopen(taskname".inp", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...