Guest User

Untitled

a guest
May 26th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int n;
  8. cin >> n;
  9. vector<int> v(n);
  10. for (int i = 0; i < n; i++) {
  11. cin >> v[i];
  12. }
  13.  
  14. bool repeat = false;
  15. for (int i = 0; i < n; i++) {
  16. if (i != v[i] && v[v[i]] == v[i]) {
  17. repeat = true;
  18. }
  19. }
  20. cout << (repeat ? "repeated" : "unique") << endl;
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment