Submission #10707

#TimeUsernameProblemLanguageResultExecution timeMemory
10707tncks0121Mobitel (COCI14_mobitel)C++14
50 / 50
0 ms1096 KiB
#include <cstdio> using namespace std; int num[26], perm[26], t[26]; char s[10000]; int main() { for(char c = 'a', n = 2; n <= 9; n++) { int a; t[n] = c - 'a'; if(n == 7 || n == 9) a = 4; else a = 3; for(char i = c; i < c+a; i++) num[i - 'a'] = n; c += a; } for(int i = 1; i <= 9; i++) { int x; scanf("%d", &x); perm[x] = i; } scanf("%s", s); int pv = -1; for(char *p = s; *p; p++) { *p -= 'a'; if(pv == num[*p]) putchar('#'); pv = num[*p]; int ac = *p - t[num[*p]] + 1; while(ac--) putchar('0' + perm[num[*p]]); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...