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