https://atcoder.jp/contests/typical90/tasks/typical90_aa
027 - Sign Up Requests (★2)
AtCoder is a programming contest site for anyone from beginners to experts. We hold weekly programming contests online.
atcoder.jp
Lowcoder라는 사이트를 다카하시군이 만들었다. N개의 문자열이 주어질때, i일에 문자열 S의 입력이 등록된다. 이미 등록됐을 경우에는 무시하고 새로 등록할시 등록한 날짜를 출력한다.
set자료구조를 이용하면 쉽게풀린다.
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <numeric>
#include <random>
#include <iostream>
#include <unordered_map>
//#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define range(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
using namespace std;
//using namespace atcoder;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;
const int INF = 2000000000;
const double pi = 3.14159265358979;
const int MOD = 100000;
void yesno(bool a)
{
if (a)
cout << "YES\n";
else
cout << "NO\n";
}
int N;
set<string> s;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> N;
rep1(i, N)
{
string tmp;
cin >> tmp;
if (s.find(tmp) != s.end())
continue;
cout << i << "\n";
s.insert(tmp);
}
return 0;
}
'알고리즘 > atcoder90제' 카테고리의 다른 글
앳코더90 - 030 - K Factors(★5) (0) | 2024.11.26 |
---|---|
앳코더90 - 028 - Cluttered Paper(★4) (0) | 2024.11.23 |
앳코더90 - 026 - Independent Set on a Tree(★4) (0) | 2024.11.20 |
앳코더90 - 024 - Select +/- One(★2) (0) | 2024.11.19 |
앳코더90 - 022 - Cubic Cake(★2) (0) | 2024.11.16 |