Submission #1163190

#TimeUsernameProblemLanguageResultExecution timeMemory
1163190BigBadBullyMobitel (COCI14_mobitel)C++20
50 / 50
1 ms328 KiB
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <bits/stdc++.h> #define int long long #define pii pair<int,int> #define ff first #define ss second using namespace std; const int mod = 1e9+7; void solve() { vector<int> mapa(10); for (int i = 1; i <= 9; i++) { int x; cin >> x; mapa[x] = i; } vector<string> ng('z'+1); ng['a'] = "2"; ng['b'] = "22"; ng['c'] = "222"; ng['d'] = "3"; ng['e'] = "33"; ng['f'] = "333"; ng['g'] = "4"; ng['h'] = "44"; ng['i'] = "444"; ng['j'] = "5"; ng['k'] = "55"; ng['l'] = "555"; ng['m'] = "6"; ng['n'] = "66"; ng['o'] = "666"; ng['p'] = "7"; ng['q'] = "77"; ng['r'] = "777"; ng['s'] = "7777"; ng['t'] = "8"; ng['u'] = "88"; ng['v'] = "888"; ng['w'] = "9"; ng['x'] = "99"; ng['y'] = "999"; ng['z'] = "9999"; string s; cin >> s; int n = s.length(); string ans; for (int i = 0; i < n;i++) { if (ans.size() && ng[s[i]][0] == ans[ans.size()-1]) ans.push_back('#'); ans+=ng[s[i]]; } for (int i = 0; i < ans.size(); i++) if (ans[i] != '#') ans[i] = char(mapa[ans[i]-'0']+'0'); for(char c: ans)cout << c; cout << '\n'; } signed main() { ios::sync_with_stdio(0); int t = 1; //cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...