Skip to content

Instantly share code, notes, and snippets.

@Acarus
Created April 5, 2017 16:14
Show Gist options
  • Save Acarus/586b588882c694f86d483a5550a96f8d to your computer and use it in GitHub Desktop.
Save Acarus/586b588882c694f86d483a5550a96f8d to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
inline bool eq(vector<int>& a, vector<int>& b, int l, int r) {
for (int i = l; i <= r; ++i) {
if (a[i] != b[i])return false;
}
return true;
}
int main() {
#ifdef HOME
freopen("/home/acarus/input.txt", "r", stdin);
#endif
ios_base::sync_with_stdio(false);
int n, l, r;
cin >> n >> l >> r;
--l, --r;
vector<int> a(n);
for (int i = 0; i < n; ++i) cin >> a[i];
vector<int> b(n);
for (int i = 0; i < n; ++i) cin >> b[i];
sort(begin(a) + l, begin(a) + r + 1);
sort(begin(b) + l, begin(b) + r + 1);
if (!eq(a, b, l, r)) {
cout << "LIE" << endl;
return 0;
}
sort(begin(a), end(a));
sort(begin(b), end(b));
if (!eq(a, b, 0, n - 1)) {
cout << "LIE" << endl;
return 0;
}
cout << "TRUTH" << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment