Submission #622439

#TimeUsernameProblemLanguageResultExecution timeMemory
622439kabikaProgramiranje (COCI17_programiranje)C++14
40 / 80
3079 ms1732 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; int q; cin >> q; while(q--) { int a, b, c, d; cin >> a >> b >> c >> d; if(b-a != d-c) { cout << "NE\n"; continue; } if(a == c && b == d) { cout << "DA\n"; continue; } if(a >= c && b >= d) { swap(a,c); swap(b,d); } if(b >= c) { swap(b,c); --b; ++c; } //cout << a << " " << b << " " << c << " " << d << '\n'; string s1(s,a-1,b-a+1); string s2(s,c-1,d-c+1); //cout << s1 << " " << s2 << '\n'; sort(s1.begin(),s1.end()); sort(s2.begin(),s2.end()); if(s1 == s2) cout << "DA\n"; else cout << "NE\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...