#include <iostream>
using namespace std;
// int v[90];
int main(){
int N, v[90];
int broj = 1;
char sol, X, Y;
cin >> sol;
cin >> N;
//v[(int)sol] += 1;
for(int i = 0; i < N; ++i){
cin >> X >> Y;
if(sol == Y){
sol = X;
v[(int)X] += 1;
if(v[(int)X] == 1){
broj += 1;
}
}
}
cout << sol << endl;
cout << broj;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |
3 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |
4 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |
5 |
Partially correct |
2 ms |
256 KB |
Output is partially correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Partially correct |
2 ms |
376 KB |
Output is partially correct |