fork download
  1. #include <bits/stdc++.h>
  2. using namespace std ;
  3. #define fast ios_base::sync_with_stdio(0);cin.tie(0);
  4. #define endl "\n"
  5. #define int long long
  6. #define ll long long
  7. #define str string
  8.  
  9. ll FP(ll base , ll p ){
  10. if (p == 1) {
  11. return base ;
  12. }
  13. ll ans = FP(base , p/2) ;
  14. if (p % 2 == 0){
  15. return ans * ans ;
  16. }
  17. else {
  18. return base * ans * ans ;
  19. }
  20.  
  21. }
  22.  
  23.  
  24.  
  25.  
  26. int32_t main ()
  27. {
  28. fast
  29. int t ; cin >> t ;
  30. while (t--) {
  31. int n , m , k ; cin >> n >> m >> k ;
  32. int arr1[m] ; int arr2[k] ;
  33. for (int i = 0 ; i < m ; i ++) {
  34. cin >> arr1[i] ;
  35. }
  36. for (int i = 0 ; i < k ; i ++) {
  37. cin >> arr2[i] ;
  38. }
  39. int tlist = 0;
  40. if (n-k ==1) {
  41. for(int i = 1 ; i <= n ; i++) {
  42. if (binary_search(arr2 , arr2 + k , i) == 0) {
  43. tlist = i ;
  44. break ;
  45. }
  46. }
  47. }
  48. //cerr << tlist ;
  49.  
  50. if (n-k > 1) {
  51. while(m--) {
  52. cout << 0 ;
  53. }
  54. cout << endl ;
  55. }
  56. else if (n==k) {
  57. while (m--) {
  58. cout << 1 ;
  59. }
  60. cout << endl ;
  61. }
  62. else {
  63. for (int i = 0 ; i < m ; i++) {
  64. if(i+1 == tlist) {
  65. cout << 1 ;
  66. }
  67. else {
  68. cout << 0 ;
  69. }
  70. }
  71. cout << endl ;
  72. }
  73. }
  74.  
  75.  
  76.  
  77.  
  78. return 0 ;
  79. }
Success #stdin #stdout 0.01s 5284KB
stdin
4
4 4 3
1 2 3 4
1 3 4
5 4 3
1 2 3 4
1 3 4
4 4 4
1 2 3 4
1 2 3 4
2 2 1
1 2
2
stdout
0100
0000
1111
10