# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
10707 | tncks0121 | Mobitel (COCI14_mobitel) | C++14 | 0 ms | 1096 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |