Accepted
Code
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int M = sc.nextInt();
sc.nextLine();
String[] str1 = new String[M];
boolean[] rst = new boolean[M];
for (int i = 0; i < M; i++) {
str1[i] = sc.nextLine();
}
int N = sc.nextInt();
sc.nextLine();
String[] str2 = new String[N];
for (int j = 0; j < N; j++) {
str2[j] = sc.nextLine();
boolean found = false;
boolean already = false;
for (int i = 0; i < M; i++) {
if (str2[j].equals(str1[i])) {
found = true;
if (rst[i]) {
already = true;
}
else {
rst[i] = true;
}
break;
}
}
if (!found) {
System.out.println("Sorry, not on the list.");
}
else if (already) {
System.out.println("Already inside!");
}
else {
System.out.println("Welcome!");
}
}
}
}
Information
- Submit By
- Type
- Submission
- Problem
- P1227 LUCC Party Check-in
- Contest
- LUCC Presents Intra LU Junior Programming Contest - Replay
- Language
- Java 8 (OpenJDK 1.8.0_422)
- Submit At
- 2025-09-02 16:29:07
- Judged At
- 2025-09-02 16:29:07
- Judged By
- Score
- 100
- Total Time
- 103ms
- Peak Memory
- 11.898 MiB