fork download
  1. #ifndef POINTER05_H_
  2. #define POINTER05_H_
  3.  
  4. #include <cstdio>
  5. #include <cstdlib>
  6. #include <cstring>
  7. #include <cassert>
  8.  
  9. int find_length (int *head, int *tail);
  10.  
  11. int main ()
  12. {
  13. int n;
  14. scanf("%d", &n);
  15.  
  16. int *arr = (int *) malloc(sizeof(int[200'000]));
  17. for (int i = 0, l, r; i < n; i++)
  18. {
  19. scanf("%d", &l);
  20. r = find_length(&arr[0], &arr[l - 1]);
  21. if (l != r)
  22. {
  23. printf("peach found bug at #%d: expect %d but get %d\n", i, l, r);
  24. return 0;
  25. }
  26. }
  27.  
  28. printf("peach check: ok\n");
  29. }
  30. #endif // POINTER05_H_
  31.  
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty