# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
328810 | Halit | Mobitel (COCI14_mobitel) | C++17 | 1 ms | 384 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>
using namespace std;
int main(){
vector<int> v(9);
for(int &e : v)
cin >> e;
vector<int> pre = { 0, 3, 6, 9, 12, 15, 19, 22, 26};
int last = 1;
string s;
cin >> s;
auto to_int = [&](char ch){ return ch-'a'+1; };
auto write = [&](int cur){
int digit = 2, F;
for(int i = 0;i+1 < 9;++i)
if(cur > pre[i] && cur <= pre[i+1])
digit += i, F = cur-pre[i];
if(last == digit)
cout << '#';
for(int j = 0;j < 9;++j)
if(v[j] == digit)
for(int i = 0;i < F;++i)
cout << j+1;
last = digit;
};
for(char e : s)
write(to_int(e));
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |