# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
119259 | 2019-06-20T19:07:36 Z | Rubanov | Elder (COCI19_elder) | C++17 | 3 ms | 384 KB |
#include <bits/stdc++.h> #define ll long long #define f first #define s second using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); char a; int n,cnt=1; cin>>a>>n; bool us[260]={}; us[a]=1; while (n--) { char z1,z2; cin>>z1>>z2; if (a==z2) { a = z1; if (!us[a]) cnt++; us[a]=1; } } cout<<a<<'\n'<<cnt; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 3 ms | 356 KB | Output is correct |