Loading...
Submission
# When Author Problem Language CPU Memory
20844 2024-06-09 11:38:04 AHAMMED_99 Cheaters C 0 ms 0 kb Compilation Error
Test Cases
# CPU Memory Points
1 0 ms 0 kb 0 Compilation Error
2 0 ms 0 kb 0 Skipped
Source Code
  1. #include <stdio.h>
  2.  
  3. // Function to find and print the order of cheaters
  4. void findCheaters(int n, int a[]) {
  5. int cheaters[n + 1] = {0}; // Array to store the order of cheaters
  6.  
  7. // Iterate through the array 'a' to find the cheaters' order
  8. for (int i = 0; i < n; i++) {
  9. cheaters[a[i]] = i + 1; // Store the order of each cheater
  10. }
  11.  
  12. // Print the order of cheaters
  13. for (int i = 1; i <= n; i++) {
  14. printf("%d ", cheaters[i]); // Print the order of each cheater
  15. }
  16. printf("\n");
  17. }
  18.  
  19. int main() {
  20. int t;
  21. scanf("%d", &t); // Input number of test cases
  22.  
  23. while (t--) {
  24. int n;
  25. scanf("%d", &n); // Input number of students
  26. int a[n];
  27. for (int i = 0; i < n; i++) {
  28. scanf("%d", &a[i]); // Input the ids of the students
  29. }
  30.  
  31. // Function call to find and print the cheaters' order
  32. findCheaters(n, a);
  33. }
  34.  
  35. return 0;
  36. }
  37.