Solution of 'Tom Riddle's Diary' (Codeforces)

 Hey everyone! Here's my solution of the question- Tom Riddle's Diary from Codeforces. If you guys have any suggestion do comment. T.Y. and Happy coding.

question link: https://codeforces.com/contest/855/problem/A

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    vector<string>v;
    int n;
    cin>>n;
    string a[n];
    for(int i=0;i<n;i++){
        string p;
        cin>>p;
        v.push_back(p);
        int h=count(v.begin(), v.end(),p);
        if(h==1a[i]="NO";
        else a[i]="YES";
    }
    for(int j=0;j<n;j++) cout<<a[j]<<'\n';
    return 0;
}

Comments

Popular posts from this blog

Solution of 'The Two Dishes' (Codechef)

Solution of 'Less or Equal' (Codeforces)