Test Cases
CPU | Memory | Verdict | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 105 ms | 38436 kb | Wrong Answer | ||||||||
2 | - | - | Skipped | ||||||||
Source Code
program.java
import java.util.Scanner; public class Main { // Read the number of test cases int t = sc.nextInt(); for (int i = 0; i < t; i++) { // Read the number of students who cheated int n = sc.nextInt(); // Initialize the boolean array to track which student passed the solution boolean[] passed = new boolean[n + 1]; // Read the IDs of the students who cheated and mark them as passed for (int j = 1; j <= n; j++) { int id = sc.nextInt(); passed[id] = true; } // Find the student who leaked the solution int cheaterId = 0; for (int j = 1; j <= n; j++) { if (!passed[j]) { cheaterId = j; break; } } // Output the ID of the cheater who leaked the solution // Print a space if it's not the last test case if (i < t - 1) { } } } }