Submission #625944

#TimeUsernameProblemLanguageResultExecution timeMemory
625944elesisProgramiranje (COCI17_programiranje)C++14
80 / 80
33 ms11644 KiB
#include<bits/stdc++.h> using namespace std; #define fast ios_base::sync_with_stdio(false);cin.tie(0); #define int long long #define pii pair<int,int> #define ff first #define ss second const int inf=1e11+7; const int N=107; const int mod =1000000007; vector <int> adj[N]; void solve() { string s; cin>>s; vector <vector <int>> pref(26,vector <int> (s.size()+1,0)); //cout << pref[1][0] << '\n'; int n=s.size(); for(int i=0;i<26;i++) { for(int j=1;j<=n;j++) { pref[i][j]=pref[i][j-1]; if((s[j-1]-97)==i) { pref[i][j]++; } } } //cout << pref[1][5] << "\n"; int q; cin>>q; while(q--) { int a,b,c,d; cin>>a>>b>>c>>d; bool flag=true; for(int i=0;i<26;i++) { if((pref[i][b]-pref[i][a-1])!=pref[i][d]-pref[i][c-1]) { //cout << a << " " << b << " " << c << " " << d << '\n'; flag=false; break; } } if(flag) { cout << "DA" << '\n'; } else { cout << "NE" << "\n"; } } } signed main() { fast clock_t start, end; start = clock(); solve(); end = clock(); double time_taken=double(end-start)/double(CLOCKS_PER_SEC); //cout << "time taken" << " " << time_taken << "\n"; }

Compilation message (stderr)

programiranje.cpp: In function 'int main()':
programiranje.cpp:66:12: warning: unused variable 'time_taken' [-Wunused-variable]
   66 |     double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
      |            ^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...