/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 1ms 532.0 KiB
#4 Accepted 2ms 488.0 KiB

Code

#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main() {
    int M;
    cin >> M;

    vector<string> guestList;
    for (int i = 0; i < M; i++) {
        string name;
        cin >> name;
        guestList.push_back(name);
    }

    int N;
    cin >> N;

    vector<string> entered;

    for (int i = 0; i < N; i++) {
        string arriving;
        cin >> arriving;

        bool onList = false;
        for (int j = 0; j < M; j++) {
            if (guestList[j] == arriving) {
                onList = true;
                break;
            }
        }

        if (!onList) {
            cout << "Sorry, not on the list." << endl;
            continue;
        }

        bool alreadyInside = false;
        for (int j = 0; j < (int)entered.size(); j++) {
            if (entered[j] == arriving) {
                alreadyInside = true;
                break;
            }
        }

        if (alreadyInside) {
            cout << "Already inside!" << endl;
        } else {
            cout << "Welcome!" << endl;
            entered.push_back(arriving);
        }
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1227 LUCC Party Check-in
Contest
LUCC Presents Intra LU Junior Programming Contest - Replay
Language
C++11 (G++ 13.2.0)
Submit At
2025-09-02 16:55:43
Judged At
2025-09-02 16:55:43
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB