# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
758112 | KN200711 | Mobitel (COCI14_mobitel) | C++14 | 1 ms | 212 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 <bits/stdc++.h>
# define ll long long
using namespace std;
int pos[10];
int val(char a) {
int x = a - 'a';
x /= 3;
x += 2;
return x;
}
int ch(char a) {
int x = a - 'a';
// cout<<x<<endl;
x %= 3;
x++;
return x;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
for(int i=1;i<=9;i++) {
int a;
cin>>a;
pos[a] = i;
}
string S;
cin>>S;
for(int i=0;i<S.length();i++) {
if(i > 0 && val(S[i - 1]) == val(S[i])) {
cout<<"#";
}
for(int d=0;d<ch(S[i]);d++) cout<<pos[val(S[i])];
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |