fork download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define all(v) v.begin(),v.end()
  4. #define endl '\n'
  5. #define PI acos(-1)
  6. using namespace std;
  7. void fast()
  8. {
  9. std::ios_base::sync_with_stdio(0);
  10. cin.tie(0);
  11. cout.tie(0);
  12. }
  13.  
  14. ll frea[27], freb[27];
  15.  
  16. int main()
  17. {
  18. fast();
  19. int tt; cin >> tt;
  20. while (tt--)
  21. {
  22. memset(frea, 0, sizeof frea);
  23. memset(freb, 0, sizeof freb);
  24. bool p = true;
  25. ll n, k; cin >> n >> k;
  26. string a, b; cin >> a >> b;
  27. for (auto i : a)
  28. frea[i - 'a']++;
  29. for (auto i : b)
  30. freb[i - 'a']++;
  31. for (int i = 0; i < 26; i++)
  32. {
  33. ll m = min(frea[i], freb[i]);
  34. frea[i] -= m;
  35. freb[i] -= m;
  36. }
  37. for (int i = 0; i < 26; i++)
  38. {
  39. if (!(freb[i] % k)) {
  40. for (int j = 0; j < i; j++)
  41. {
  42. if (frea[j] >= k)
  43. {
  44. ll m = min(freb[i], frea[j]);
  45. frea[j] -= m;
  46. freb[i] -= m;
  47. }
  48. if (!freb[i])
  49. break;
  50. }
  51. }
  52. else {
  53. p = false;
  54. break;
  55. }
  56. }
  57.  
  58. for(int i=0;i<26;i++)
  59. if (frea[i] != freb[i])
  60. {
  61. p = false;
  62. break;
  63. }
  64.  
  65. if (p)
  66. cout << "YES" << endl;
  67. else
  68. cout << "NO" << endl;
  69. }
  70. return 0;
  71. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
Main.java:2: error: illegal character: '#'
#define ll long long 
^
Main.java:3: error: illegal character: '#'
#define all(v) v.begin(),v.end()
^
Main.java:4: error: illegal character: '#'
#define endl '\n'
^
Main.java:5: error: illegal character: '#'
#define PI acos(-1)
^
Main.java:7: error: class, interface, or enum expected
void fast()
^
Main.java:10: error: class, interface, or enum expected
    cin.tie(0);
    ^
Main.java:11: error: class, interface, or enum expected
    cout.tie(0);
    ^
Main.java:12: error: class, interface, or enum expected
}
^
Main.java:16: error: class, interface, or enum expected
int main()
^
Main.java:19: error: class, interface, or enum expected
    int tt; cin >> tt;
    ^
Main.java:19: error: class, interface, or enum expected
    int tt; cin >> tt;
            ^
Main.java:20: error: class, interface, or enum expected
    while (tt--)
    ^
Main.java:23: error: class, interface, or enum expected
        memset(freb, 0, sizeof freb);
        ^
Main.java:24: error: class, interface, or enum expected
        bool p = true;
        ^
Main.java:25: error: class, interface, or enum expected
        ll n, k; cin >> n >> k;
        ^
Main.java:25: error: class, interface, or enum expected
        ll n, k; cin >> n >> k;
                 ^
Main.java:26: error: class, interface, or enum expected
        string a, b; cin >> a >> b;
        ^
Main.java:26: error: class, interface, or enum expected
        string a, b; cin >> a >> b;
                     ^
Main.java:27: error: class, interface, or enum expected
        for (auto i : a)
        ^
Main.java:29: error: class, interface, or enum expected
        for (auto i : b)
        ^
Main.java:31: error: class, interface, or enum expected
        for (int i = 0; i < 26; i++)
        ^
Main.java:31: error: class, interface, or enum expected
        for (int i = 0; i < 26; i++)
                        ^
Main.java:31: error: class, interface, or enum expected
        for (int i = 0; i < 26; i++)
                                ^
Main.java:34: error: class, interface, or enum expected
            frea[i] -= m;
            ^
Main.java:35: error: class, interface, or enum expected
            freb[i] -= m;
            ^
Main.java:36: error: class, interface, or enum expected
        }
        ^
Main.java:37: error: class, interface, or enum expected
        for (int i = 0; i < 26; i++)
                        ^
Main.java:37: error: class, interface, or enum expected
        for (int i = 0; i < 26; i++)
                                ^
Main.java:40: error: class, interface, or enum expected
                for (int j = 0; j < i; j++)
                                ^
Main.java:40: error: class, interface, or enum expected
                for (int j = 0; j < i; j++)
                                       ^
Main.java:45: error: class, interface, or enum expected
                        frea[j] -= m;
                        ^
Main.java:46: error: class, interface, or enum expected
                        freb[i] -= m;
                        ^
Main.java:47: error: class, interface, or enum expected
                    }
                    ^
Main.java:50: error: class, interface, or enum expected
                }
                ^
Main.java:54: error: class, interface, or enum expected
                break;
                ^
Main.java:55: error: class, interface, or enum expected
            }
            ^
Main.java:58: error: class, interface, or enum expected
        for(int i=0;i<26;i++)
                    ^
Main.java:58: error: class, interface, or enum expected
        for(int i=0;i<26;i++)
                         ^
Main.java:62: error: class, interface, or enum expected
                break;
                ^
Main.java:63: error: class, interface, or enum expected
            }
            ^
Main.java:67: error: class, interface, or enum expected
        else
        ^
Main.java:69: error: class, interface, or enum expected
    }
    ^
Main.java:71: error: class, interface, or enum expected
}
^
45 errors
stdout
Standard output is empty