# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
96700 | nandonathaniel | Elder (COCI19_elder) | C++14 | 2 ms | 376 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;
bool pernah[26];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
char now;
cin >> now;
pernah[now-'A']=true;
int n;
cin >> n;
for(int i=1;i<=n;i++){
char win,lose;
cin >> win >> lose;
if(lose==now){
now=win;
pernah[now-'A']=true;
}
}
int ans=0;
for(int i=0;i<26;i++){
if(pernah[i])ans++;
}
cout << now << endl;
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |