답안 #222083

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222083 2020-04-12T06:09:57 Z Vimmer Elder (COCI19_elder) C++14
50 / 50
5 ms 384 KB
#include <bits/stdc++.h>

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")

#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 300005
#define MOD ll(998244353)

using namespace std;

typedef long long ll;

typedef long double ld;



int main()
{

    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    char c;

    cin >> c;

    int n;

    cin >> n;

    set <char> se; se.clear();

    se.insert(c);

    for (int i = 0; i < n; i++)
    {
        char z1, z2;

        cin >> z1 >> z2;

        if (z2 == c) {se.insert(z1); c = z1;}
    }

    cout << c << endl << sz(se);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct