Submission #921309

# Submission time Handle Problem Language Result Execution time Memory
921309 2024-02-03T16:54:03 Z JoksimKaktus Elder (COCI19_elder) C++17
50 / 50
1 ms 456 KB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
void output(bool yes){yes ? cout << "Yes" << "\n" : cout << "No" << "\n";}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(0);
    set <int> s;
    char x;
    int cur;
    cin >> x;
    cur = x - 'A';
    s.insert(cur);
    int n;
    cin >> n;
    for(int i = 0;i < n;i++){
        char a,b;
        cin >> a >> b;
        int w = a - 'A';
        int l = b - 'A';
        if(l == cur){
            cur = w;
            s.insert(w);
        }
    }
    cout << char(cur+65) << "\n";
    cout << s.size() << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 456 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct