Submission #157573

# Submission time Handle Problem Language Result Execution time Memory
157573 2019-10-12T13:11:41 Z dcj Elder (COCI19_elder) C++14
50 / 50
2 ms 380 KB
#include <iostream>

using namespace std;

char Z1, Z2, p;
int N, br=0, v[30];
	
int main()
{
	cin >> p;
	cin >> N;
	v[p - 'A'] = 1;
	for (int i=1; i<=N;i++) {
		cin >> Z1 >> Z2;
		if (Z2==p) {
			v[Z1 - 'A']=1;
			p=Z1;
		}
	}
	for (int i=0;i<=26;i++) 
		br+=v[i];
	cout << p << endl;
	cout << br;
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct