Submission #119259

#TimeUsernameProblemLanguageResultExecution timeMemory
119259RubanovElder (COCI19_elder)C++17
50 / 50
3 ms384 KiB
#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 (stderr)

elder.cpp: In function 'int main()':
elder.cpp:14:7: warning: array subscript has type 'char' [-Wchar-subscripts]
   us[a]=1;
       ^
elder.cpp:20:16: warning: array subscript has type 'char' [-Wchar-subscripts]
       if (!us[a])
                ^
elder.cpp:22:11: warning: array subscript has type 'char' [-Wchar-subscripts]
       us[a]=1;
           ^
#Verdict Execution timeMemoryGrader output
Fetching results...