fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int a[5]={2,4,7,1,5};
  7. int b[3]={5,4,2};
  8. unordered_set<int>m;
  9. for(int i=0;i<5;i++){
  10. m.insert(a[i]);
  11. }
  12. for(int i=0;i<3;i++){
  13. if(m.count(b[i])==0){
  14. cout<<"there exist subarray";
  15. }
  16. else{
  17. cout<<"there does not exit subarray";
  18. }
  19.  
  20. }
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
there does not exit subarraythere does not exit subarraythere does not exit subarray