Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1.  
  2. /**
  3. * => Md. Sajjat Hosen
  4. * => Department of Computer Science and Engineering
  5. * => Bangabandhu Sheikh Mujibur Rahman Science and Technology University
  6. **/
  7.  
  8. /*..................! TRY ONCE MORE !..................*/
  9.  
  10. /*...Part - 01...*/
  11.  
  12. #include <bits/stdc++.h>
  13. using namespace std ;
  14.  
  15. /*...Part - 02...*/
  16.  
  17. typedef long long ll ;
  18. typedef long double ld ;
  19. typedef unsigned long long ull ;
  20. typedef pair<int,int> pii ;
  21. typedef pair<ll,ll> pll ;
  22. typedef vector<int> vi ;
  23. typedef vector<ll> vll ;
  24. typedef vector<vector<int>> vvi ;
  25.  
  26. int Int(){int x ; scanf("%d",&x) ; return x ;}
  27. ll Long(){ll x ; scanf("%lld",&x) ; return x ;}
  28. float Float(){float x ; scanf("%f",&x) ; return x ;}
  29. double Double(){double x ; scanf("%lf",&x); return x;}
  30.  
  31. /*...Part - 03...*/
  32. /*....Debugger....*/
  33.  
  34. #define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
  35. void err(istream_iterator<string> it) {cout << endl ;}
  36. template<typename T, typename... Args>
  37. void err(istream_iterator<string> it, T a, Args... args) {
  38. cerr << *it << " = " << a << ' ' ;
  39. err(++it, args...);
  40. }
  41.  
  42. /*...Part - 04...*/
  43. /*...Needed to change according to problem requirements...*/
  44.  
  45. const int N = (int)2e5 + 5 ;
  46. const int maxN = (int)1e6 + 6 ;
  47. const ll Mod = (ll)1e9 + 7 ;
  48. const int inf = (int)2e9 ;
  49. const ll Inf = (ll)1e18 ;
  50.  
  51. /*..........................................................*/
  52. /*...Part - 05...*/
  53.  
  54. #define debug(x) cerr << #x << " = " << x << '\n' ;
  55. #define rep(i,b,e) for(__typeof(e) i = (b) ; i != (e + 1) - 2 * ((b) > (e)) ; i += 1 - 2 * ((b) > (e)))
  56. #define Int Int()
  57. #define Long Long()
  58. #define Float Float()
  59. #define Double Double()
  60. #define all(x) x.begin() , x.end()
  61. #define sz(x) (int)x.size()
  62. #define ff first
  63. #define ss second
  64. #define pb push_back
  65. #define eb emplace_back
  66. #define mem(a) memset(a , 0 ,sizeof a)
  67. #define memn(a) memset(a , -1 ,sizeof a)
  68.  
  69. /*...Part - 06...*/
  70. /*...... ! Code start from here ! ......*/
  71.  
  72. int n, m, x, y, flag;
  73.  
  74. inline void Yes(){printf("Yes\n");}
  75. inline void No(){printf("No\n");}
  76. inline void YES(){printf("YES\n");}
  77. inline void NO(){printf("NO\n");}
  78.  
  79. int main(){
  80. //freopen("input.txt","r",stdin);
  81. int test = Int , tc = 0 ;
  82. while(test--){
  83. flag = 0;
  84. n = Int;
  85. m = Int;
  86. int a[n + 5], b[m];
  87. a[0] = 0;
  88. for(int i = 1; i <= n; i++)
  89. a[i] = Int;
  90. for(int i = 0; i < m; i++)
  91. b[i] = Int;
  92. sort(b, b + m);
  93. x = b[0];
  94. y = b[m - 1] + 1;
  95. for(int i = 0; i < m - 1; i++){
  96. if(b[i] + 1 != b[i + 1]){
  97. y = b[i] + 1;
  98. sort(a + x, a + y + 1);
  99. x = b[i + 1];
  100. y = b[m - 1] + 1;
  101. }
  102. }
  103. sort(a + x, a + y + 1);
  104. for(int i = 1; i < n; i++){
  105. if(a[i] <= a[i + 1]){
  106.  
  107. }
  108. else{
  109. flag = 1;
  110. break;
  111. }
  112. }
  113. if(flag == true) NO();
  114. else YES();
  115. }
  116. return 0 ;
  117. }
  118.  
  119. /*...Always look at the part - 04...*/
  120. /*...............END................*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement