Submission #96668

# Submission time Handle Problem Language Result Execution time Memory
96668 2019-02-10T17:09:44 Z Ort Elder (COCI19_elder) C++11
50 / 50
2 ms 376 KB
#include<iostream>
#include<vector>
#include<set>

using namespace std;


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    char nosilac;
    cin >> nosilac;
    int n, cnt;
    cin >> n;
    char a, b;
    set<char> s;
    s.insert(nosilac);
    for(int i=0;i<n;i++) {
    	cin >> a >> b;
    	if(nosilac==b) {
    		nosilac = a;
			s.insert(a);	
    	}
	}
	cout << nosilac << "\n" << s.size();
    return 0;
}

Compilation message

elder.cpp: In function 'int main()':
elder.cpp:13:12: warning: unused variable 'cnt' [-Wunused-variable]
     int n, cnt;
            ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct