Submission #293380

# Submission time Handle Problem Language Result Execution time Memory
293380 2020-09-08T01:25:14 Z 7_7_7 Elder (COCI19_elder) C++17
50 / 50
1 ms 392 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);

    char x, a, b;
    int n, cnt = 1;
    cin >> x >> n;
    map<char, int> used;
    used[x] = 1;
    for(int i = 1; i <= n; i ++){
        cin >> a >> b;
        if(b == x){
            x = a;
            used[x] = 1;
        }
    }
    cout << x << "\n" << (int)used.size() << "\n";
}

Compilation message

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