/ SeriousOJ /

Record Detail

Accepted


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

Code

/*
    Author: abdmahdi56
*/
#include <bits/stdc++.h>
#define endl '\n'
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define vi vector<ll>
#define all(v) v.begin(), v.end()
#define loop(n) for(int i = 0; i < (n); i++)

using namespace std;

void Bismillah()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

void solve()
{
    int m;
    cin>>m;
    string s1[m];
    vector<string>s3;
    for(int i=0; i<m; i++)
    {
        cin>>s1[i];
    }
    int n;
    cin>>n;
    string s2[n];
    for(int i=0; i<n; i++)
    {
        cin>>s2[i];
    }

    bool ok =true;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            if(s2[i]==s1[j])
            {
                bool in=false;
                for(int k=0; k < s3.size(); k++)
                {
                    if(s2[i]==s3[k])
                    {
                        in=true;
                        s3.push_back(s2[i]);
                        ok=true;
                        break;
                    }
                    else
                    {
                        in=false;
                    }

                }
                if(in)
                {
                    cout<<"Already inside!\n";
                    ok=true;
                    break;

                }
                else
                {
                    cout<<"Welcome!\n";
                    ok=true;
                    s3.push_back(s2[i]);
                    break;
                }
            }
            else
            {
              ok=false;
            }
        }
        if(!ok) {
                cout<<"Sorry, not on the list.\n";


                }

    }
}
int main()
{
    Bismillah();
    int t=1;
    //cin >> t=1;
    while (t--)
    {
        solve();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1227 LUCC Party Check-in
Contest
LUCC Presents Kick & Code Intra LU Programming Contest
Language
C++17 (G++ 13.2.0)
Submit At
2025-09-01 07:15:19
Judged At
2025-09-01 07:15:19
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB