# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377155 | marat0210 | Elder (COCI19_elder) | C++14 | 2 ms | 492 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |