답안 #257981

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
257981 2020-08-05T07:14:58 Z Vladikus004 Elder (COCI19_elder) C++14
50 / 50
1 ms 384 KB
#include <bits/stdc++.h>
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;

char a;
int n;
set <char> ms;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
    #endif // LOCAL
    cin >> a >> n;
    ms.insert(a);
    for (int i = 0; i < n; i++){
        char x, y;
        cin >> x >> y;
        if (y == a){
            a = x;
            ms.insert(a);
        }
    }
    cout << a << "\n";
    cout << ms.size() << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct