답안 #377155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
377155 2021-03-13T04:52:09 Z marat0210 Elder (COCI19_elder) C++14
29 / 50
2 ms 492 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s;
    cin >>s;
    int n;
    cin >>n;
    string res = s;
    vector <pair<string, string>> f;
    for (int i = 0; i < n; ++i) {
        string a, b;
        cin >>a>>b;
        f.push_back({a, b});
    }
    int cnt = 1;
    for (int i = 0; i < n; ++i) {
        if (f[i].second == res) {
            res = f[i].first;
            cnt++;
        }
    }
    cout <<res<<endl;
    cout <<cnt<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 364 KB Output is partially correct
2 Correct 1 ms 364 KB Output is correct
3 Partially correct 1 ms 364 KB Output is partially correct
4 Partially correct 1 ms 364 KB Output is partially correct
5 Partially correct 1 ms 364 KB Output is partially correct
6 Correct 1 ms 364 KB Output is correct
7 Partially correct 1 ms 364 KB Output is partially correct
8 Correct 2 ms 492 KB Output is correct
9 Partially correct 1 ms 364 KB Output is partially correct
10 Partially correct 1 ms 364 KB Output is partially correct