Submission #398751

#TimeUsernameProblemLanguageResultExecution timeMemory
398751AlexandraMobitel (COCI14_mobitel)C++14
50 / 50
1 ms204 KiB
#include <iostream> #include <string> #include <vector> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); vector<int> n(9); string s; int prev = 1; for (int i=0; i<9; i++) { int in; cin >> in; n[in-1] = i+1; } cin >> s; for (int i=0; i<s.length(); i++) { if (s[i]=='a') { if (prev==2) { cout << "#"; } cout << n[1]; prev=2; } else if (s[i]=='b') { if (prev==2) { cout << "#"; } cout << n[1] << n[1]; prev=2; } else if (s[i]=='c') { if (prev==2) { cout << "#"; } cout << n[1] << n[1] << n[1]; prev=2; } else if (s[i]=='d') { if (prev==3) { cout << "#"; } cout << n[2]; prev=3; } else if (s[i]=='e') { if (prev==3) { cout << "#"; } cout << n[2] << n[2]; prev=3; } else if (s[i]=='f') { if (prev==3) { cout << "#"; } cout << n[2] << n[2] << n[2]; prev=3; } else if (s[i]=='g') { if (prev==4) { cout << "#"; } cout << n[3]; prev=4; } else if (s[i]=='h') { if (prev==4) { cout << "#"; } cout << n[3] << n[3]; prev=4; } else if (s[i]=='i') { if (prev==4) { cout << "#"; } cout << n[3] << n[3] << n[3]; prev=4; } else if (s[i]=='j') { if (prev==5) { cout << "#"; } cout << n[4]; prev=5; } else if (s[i]=='k') { if (prev==5) { cout << "#"; } cout << n[4] << n[4]; prev=5; } else if (s[i]=='l') { if (prev==5) { cout << "#"; } cout << n[4] << n[4] << n[4]; prev=5; } else if (s[i]=='m') { if (prev==6) { cout << "#"; } cout << n[5]; prev=6; } else if (s[i]=='n') { if (prev==6) { cout << "#"; } cout << n[5] << n[5]; prev=6; } else if (s[i]=='o') { if (prev==6) { cout << "#"; } cout << n[5] << n[5] << n[5]; prev=6; } else if (s[i]=='p') { if (prev==7) { cout << "#"; } cout << n[6]; prev=7; } else if (s[i]=='q') { if (prev==7) { cout << "#"; } cout << n[6] << n[6]; prev=7; } else if (s[i]=='r') { if (prev==7) { cout << "#"; } cout << n[6] << n[6] << n[6]; prev=7; } else if (s[i]=='s') { if (prev==7) { cout << "#"; } cout << n[6] << n[6] << n[6] << n[6]; prev=7; } else if (s[i]=='t') { if (prev==8) { cout << "#"; } cout << n[7]; prev=8; } else if (s[i]=='u') { if (prev==8) { cout << "#"; } cout << n[7] << n[7]; prev=8; } else if (s[i]=='v') { if (prev==8) { cout << "#"; } cout << n[7] << n[7] << n[7]; prev=8; } else if (s[i]=='w') { if (prev==9) { cout << "#"; } cout << n[8]; prev=9; } else if (s[i]=='x') { if (prev==9) { cout << "#"; } cout << n[8] << n[8]; prev=9; } else if (s[i]=='y') { if (prev==9) { cout << "#"; } cout << n[8] << n[8] << n[8]; prev=9; } else if (s[i]=='z') { if (prev==9) { cout << "#"; } cout << n[8] << n[8] << n[8] << n[8]; prev=9; } } return 0; }

Compilation message (stderr)

mobitel.cpp: In function 'int main()':
mobitel.cpp:22:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for (int i=0; i<s.length(); i++) {
      |                ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...