/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 89ms 11.281 MiB
#2 Accepted 91ms 11.469 MiB
#3 Accepted 90ms 11.004 MiB
#4 Accepted 103ms 11.898 MiB

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