Source Code
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
using namespace std;

#define SPEED ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define T int t; cin>>t; while(t--){ lil_dragon(); } 
#define all(vec) vec.begin(),vec.end()
#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define vs vector<string>
#define fl(i,n) for(int i=0;i<n;i++)
#define M_PI 3.14159265358979323846
#define vv vector<vector<int>> v(n, vector<int>(m, 0))
#define gl getline(cin,s)
#define umap unordered_map
#define uset unordered_set
#define Y printf("YES\n")
#define NO printf("NO\n")
#define ff first
#define ss second
#define pb push_back
//string br = bitset<32>(n).to_string().substr(32 - log2(n)); //Binary representation
ll gcd(ll a, ll b) { if (b == 0)return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
bool isPrime(ll n) { if (n <= 1)return false; if (n <= 3)return true; if (n % 2 == 0 || n % 3 == 0)return false; for (int i = 5; i * i <= n; i = i + 6)if (n % i == 0 || n % (i + 2) == 0)return false; return true; }
bool is_odd(int n) { return n % 2 != 0; }
bool is_even(int n) { return n % 2 == 0; }
bool isPowerOfTwo(int n) { if (n == 0)return false; return (ceil(log2(n)) == floor(log2(n))); }
bool isPerfectSquare(ll x) { if (x >= 0) { ll sr = sqrt(x); return (sr * sr == x); }return false; }
ll summ(ll n) { return n * (n + 1) / 2; }
ll factorial(ll n) { ll r = 1, c = 1; while (c <= n) { r *= c; c++; }return r; }
void lil_dragon() {
   /* string s;
    cin >> s;
    sort(s.begin(), s.end());
    string k = "ABCDEFGHIJKLM";
    if (s==k) Y;
    else NO;*/
    int n;
    cin >> n;
    string s, t;
    cin >> s;
    cin >> t;
    int sta = 0, end = 0;
    if (s == t)cout << "0\n";
    else{
    sort(all(t));
    sort(all(s));
    if (s == t)cout << 1 << endl;
    else cout << 0 << endl;
    }
}
int main() {
    SPEED;
    T;
    //solve();
    return 0;
}
Copy
Split and Swap lil_dragon
GNU G++17
90 ms
1.5 MB
Accepted