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