Advertisement
Guest User

check mapping

a guest
Jan 30th, 2015
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n,BG[100010];
  6.  
  7. int main(){
  8. int temp;
  9. cin >> n ;
  10. for( int i = 0 ; i < n ; i++ ){
  11. cin >> temp ;
  12. if( temp >= 0 && temp <= 100000)
  13. BG[temp] = 1 ;
  14. }
  15.  
  16. for( int i = 1 ; i <= n ; i++ )
  17. if( BG[i] == 0 ){
  18. cout << "NO" << endl ;
  19. return 0;
  20. }
  21. cout << "YES" << endl;
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement